You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/08/06 23:38:32 UTC

[GitHub] [incubator-superset] kristw commented on a change in pull request #7998: [fix] reduce content in sql lab localStorage

kristw commented on a change in pull request #7998: [fix] reduce content in sql lab localStorage
URL: https://github.com/apache/incubator-superset/pull/7998#discussion_r311317595
 
 

 ##########
 File path: superset/assets/src/SqlLab/utils/reduxStateToLocalStorageHelper.js
 ##########
 @@ -35,3 +47,18 @@ export default function emptyQueryResults(queries) {
       return updatedQueries;
     }, {});
 }
+
+export function clearQueryEditors(queryEditors) {
+  return queryEditors.map(editor =>
+    // only return selected keys
+    Object.keys(editor).reduce((accumulator, key) => {
 
 Review comment:
   * We could make `PERSISTENT_QUERY_EDITOR_KEYS` a `Set`. 
   * `filter` before `reduce` may look a bit  cleaner.
   
   ```
   Object.keys(editor)
     .filter(key => PERSISTENT_QUERY_EDITOR_KEYS.has(key))
     .reduce((acc, key) => {
        // reuse the same acc object instead of spreading into a new object every iteration.
        // naming a constant from function param will get you pass the eslint rule no param assignment
        const output = acc;
        output[key] = editor[key];
        return output; 
     }, {});
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org