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 2022/08/08 22:49:38 UTC

[GitHub] [superset] eschutho commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

eschutho commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r940726057


##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -620,6 +677,7 @@ export function switchQueryEditor(queryEditor, displayLimit) {
   return function (dispatch) {
     if (
       isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) &&
+      queryEditor &&

Review Comment:
   maybe use optional chaining here as well?



##########
superset-frontend/src/SqlLab/App.jsx:
##########
@@ -91,6 +94,12 @@ const sqlLabPersistStateConfig = {
       const result = {
         ...initialState,
         ...persistedState,
+        sqlLab: {
+          ...(persistedState && persistedState.sqlLab),

Review Comment:
   if `persistedState` is null or undefined, this will error when you try to spread it. I'd recommend a default of an empty object.. maybe something like 
   ```suggestion
             ...(persistedState?.sqlLab || {}),
   ```



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