You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2023/04/21 13:30:22 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #23760: chore(sqllab): Refactor react-query by redux-toolkit query

michael-s-molina commented on code in PR #23760:
URL: https://github.com/apache/superset/pull/23760#discussion_r1173755420


##########
superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx:
##########
@@ -37,11 +38,32 @@ const mockedProps = {
   },
   height: 0,
 };
-const middlewares = [thunk];
-const mockStore = configureStore(middlewares);
-const store = mockStore(initialState);
+
+let store;
+let actions;
+
+const logAction = () => next => action => {
+  if (typeof action === 'function') {
+    return next(action);
+  }
+
+  actions.push(action);
+

Review Comment:
   ```suggestion
   ```



##########
superset-frontend/spec/helpers/testing-library.tsx:
##########
@@ -81,8 +95,8 @@ export function createWrapper(options?: Options) {
       result = <BrowserRouter>{result}</BrowserRouter>;
     }
 
-    if (useQuery) {
-      result = <QueryProvider>{result}</QueryProvider>;
+    if (useQuery && !useRedux) {

Review Comment:
   Previously, the developer had the option to use query params without Redux. Now it's a little bit weird because you are setting `useQuery` and the store is being configured underneath. `useQuery` is more related to the URL query params than Redux. Could you separate the concepts again?



##########
superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.jsx:
##########
@@ -37,11 +38,32 @@ const mockedProps = {
   },
   height: 0,
 };
-const middlewares = [thunk];
-const mockStore = configureStore(middlewares);
-const store = mockStore(initialState);
+
+let store;
+let actions;
+
+const logAction = () => next => action => {
+  if (typeof action === 'function') {
+    return next(action);
+  }
+

Review Comment:
   ```suggestion
   ```



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