sadpandajoe commented on code in PR #41019:
URL: https://github.com/apache/superset/pull/41019#discussion_r3432543337


##########
superset-frontend/src/SqlLab/actions/sqlLab.ts:
##########
@@ -996,7 +998,22 @@ export function removeQuery(query: Query): 
SqlLabThunkAction<Promise<unknown>> {
       : Promise.resolve();
 
     return sync
-      .then(() => dispatch({ type: REMOVE_QUERY, query }))
+      .then(() => {
+        dispatch({ type: REMOVE_QUERY, query });
+        dispatch(
+          queryHistoryApi.util.updateQueryData(
+            'editorQueries',
+            { editorId: queryEditorId },
+            draft => {
+              const index = draft.result.findIndex(({ id }) => id === 
query.id);
+              if (index !== -1) {
+                draft.result.splice(index, 1);
+                draft.count = Math.max(0, draft.count - 1);
+              }
+            },
+          ),
+        );
+      })

Review Comment:
   Example:
   - Say we have a page size of 25 and we return 26 items.
   - One of the items is deleted from page 0, so that would leave us 24 cached 
rows
   
   What would happen when we go to the next page? Would we show that one item 
or will the one item be hidden until we do a full refresh? Unsure if it's easy 
to add a test for this case but if it is, we should probably see what happens.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to