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 2021/12/10 10:11:05 UTC

[GitHub] [superset] john-bodley commented on a change in pull request #17708: feat: Persist SQL Lab autocomplete setting across tabs and visits

john-bodley commented on a change in pull request #17708:
URL: https://github.com/apache/superset/pull/17708#discussion_r766538998



##########
File path: superset-frontend/src/SqlLab/constants.ts
##########
@@ -65,3 +65,6 @@ export const SQL_FUNCTIONS_AUTOCOMPLETE_SCORE = 90;
 export const SCHEMA_AUTOCOMPLETE_SCORE = 60;
 export const TABLE_AUTOCOMPLETE_SCORE = 55;
 export const COLUMN_AUTOCOMPLETE_SCORE = 50;
+
+// LocalStorage keys
+export const SQL_LAB_AUTOCOMPLETE_SETTING_KEY = 'isSQLLabAutocompleteEnabled';

Review comment:
       Should this be `SQL_LAB_AUTOCOMPLETE_ENABLED_SETTING_KEY`?

##########
File path: superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
##########
@@ -365,9 +373,15 @@ class SqlEditor extends React.PureComponent {
   }
 
   handleToggleAutocompleteEnabled = () => {
-    this.setState(prevState => ({
-      autocompleteEnabled: !prevState.autocompleteEnabled,
-    }));
+    this.setState(prevState => {
+      setInLocalStorage(
+        SQL_LAB_AUTOCOMPLETE_SETTING_KEY,
+        !prevState.autocompleteEnabled,
+      );
+      return {

Review comment:
       Why is a return necessary when it wasn’t previously?




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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