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/07/13 12:03:12 UTC

[GitHub] [superset] zhaoyongjie opened a new pull request, #20699: fix: columns are lost when dashboard to explore

zhaoyongjie opened a new pull request, #20699:
URL: https://github.com/apache/superset/pull/20699

   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Currently, columns of datasource are lost when switching from Dashboard to the Explore page.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   ### After
   
   https://user-images.githubusercontent.com/2016594/178728938-a859afbf-45e4-4fb6-8e9c-27bcc26d8a01.mov
   
   #### Before
   
   
   
   https://user-images.githubusercontent.com/2016594/178729127-bf4a2db8-a901-4843-b10c-06d920ed742c.mov
   
   
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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


[GitHub] [superset] codecov[bot] commented on pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #20699:
URL: https://github.com/apache/superset/pull/20699#issuecomment-1183192915

   # [Codecov](https://codecov.io/gh/apache/superset/pull/20699?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#20699](https://codecov.io/gh/apache/superset/pull/20699?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3f0a418) into [master](https://codecov.io/gh/apache/superset/commit/acdb271422b937314d7175ac85eeeac5ead3bc16?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (acdb271) will **increase** coverage by `0.00%`.
   > The diff coverage is `9.09%`.
   
   ```diff
   @@           Coverage Diff           @@
   ##           master   #20699   +/-   ##
   =======================================
     Coverage   66.84%   66.84%           
   =======================================
     Files        1753     1751    -2     
     Lines       65905    65904    -1     
     Branches     7016     7017    +1     
   =======================================
   + Hits        44054    44056    +2     
   + Misses      20067    20063    -4     
   - Partials     1784     1785    +1     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `51.96% <9.09%> (+<0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/20699?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/explore/ExplorePage.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvRXhwbG9yZVBhZ2UudHN4) | `0.00% <0.00%> (ø)` | |
   | [...set-frontend/src/explore/actions/hydrateExplore.ts](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvYWN0aW9ucy9oeWRyYXRlRXhwbG9yZS50cw==) | `60.00% <100.00%> (ø)` | |
   | [...perset-frontend/src/views/components/RightMenu.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvUmlnaHRNZW51LnRzeA==) | `64.03% <0.00%> (-1.15%)` | :arrow_down: |
   | [superset-frontend/src/views/routes.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL3JvdXRlcy50c3g=) | `55.55% <0.00%> (-0.33%)` | :arrow_down: |
   | [...perset-frontend/src/addSlice/AddSliceContainer.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2FkZFNsaWNlL0FkZFNsaWNlQ29udGFpbmVyLnRzeA==) | `59.61% <0.00%> (ø)` | |
   | [superset-frontend/src/addSlice/index.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2FkZFNsaWNlL2luZGV4LnRzeA==) | | |
   | [superset-frontend/src/addSlice/App.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2FkZFNsaWNlL0FwcC50c3g=) | | |
   | [...perset-frontend/src/views/CRUD/chart/ChartList.tsx](https://codecov.io/gh/apache/superset/pull/20699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvY2hhcnQvQ2hhcnRMaXN0LnRzeA==) | `59.13% <0.00%> (+0.35%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/20699?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/20699?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [acdb271...3f0a418](https://codecov.io/gh/apache/superset/pull/20699?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920164672


##########
superset-frontend/src/explore/ExplorePage.tsx:
##########
@@ -33,11 +40,35 @@ import { fallbackExploreInitialData } from './fixtures';
 
 const loadErrorMessage = t('Failed to load chart data.');
 
-const fetchExploreData = (exploreUrlParams: URLSearchParams) =>
-  makeApi<{}, ExploreResponsePayload>({
-    method: 'GET',
-    endpoint: 'api/v1/explore/',
-  })(exploreUrlParams);
+interface ResultInterface {
+  result: {
+    form_data: QueryFormData;
+    slice: Slice;
+    dataset: Dataset;
+  };
+}
+
+const isResult = (rv: JsonObject): rv is ResultInterface =>
+  rv?.result?.form_data &&
+  rv?.result?.slice &&
+  rv?.result?.dataset &&
+  isDefined(rv?.result?.dataset?.id) &&
+  isDefined(rv?.result?.dataset?.uid);

Review Comment:
   removed uid checker



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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920823022


##########
superset-frontend/cypress-base/cypress/integration/explore/link.test.ts:
##########
@@ -28,7 +28,7 @@ import { HEALTH_POP_FORM_DATA_DEFAULTS } from './visualizations/shared.helper';
 const apiURL = (endpoint: string, queryObject: Record<string, unknown>) =>
   `${endpoint}?q=${rison.encode(queryObject)}`;
 
-describe('Test explore links', () => {
+describe.skip('Test explore links', () => {

Review Comment:
   temporarily skip this test, will reenable in the future.



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


[GitHub] [superset] kgabryje commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920000321


##########
superset-frontend/src/explore/ExplorePage.tsx:
##########
@@ -33,11 +40,35 @@ import { fallbackExploreInitialData } from './fixtures';
 
 const loadErrorMessage = t('Failed to load chart data.');
 
-const fetchExploreData = (exploreUrlParams: URLSearchParams) =>
-  makeApi<{}, ExploreResponsePayload>({
-    method: 'GET',
-    endpoint: 'api/v1/explore/',
-  })(exploreUrlParams);
+interface ResultInterface {
+  result: {
+    form_data: QueryFormData;
+    slice: Slice;
+    dataset: Dataset;
+  };
+}
+
+const isResult = (rv: JsonObject): rv is ResultInterface =>
+  rv?.result?.form_data &&
+  rv?.result?.slice &&
+  rv?.result?.dataset &&
+  isDefined(rv?.result?.dataset?.id) &&
+  isDefined(rv?.result?.dataset?.uid);

Review Comment:
   Are both `id` and `uid` required?



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


[GitHub] [superset] kgabryje commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
kgabryje commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920026188


##########
superset-frontend/src/explore/ExplorePage.tsx:
##########
@@ -33,11 +40,35 @@ import { fallbackExploreInitialData } from './fixtures';
 
 const loadErrorMessage = t('Failed to load chart data.');
 
-const fetchExploreData = (exploreUrlParams: URLSearchParams) =>
-  makeApi<{}, ExploreResponsePayload>({
-    method: 'GET',
-    endpoint: 'api/v1/explore/',
-  })(exploreUrlParams);
+interface ResultInterface {
+  result: {
+    form_data: QueryFormData;
+    slice: Slice;
+    dataset: Dataset;
+  };
+}
+
+const isResult = (rv: JsonObject): rv is ResultInterface =>
+  rv?.result?.form_data &&
+  rv?.result?.slice &&
+  rv?.result?.dataset &&
+  isDefined(rv?.result?.dataset?.id) &&
+  isDefined(rv?.result?.dataset?.uid);
+
+const fetchExploreData = async (exploreUrlParams: URLSearchParams) => {
+  try {
+    const rv = await makeApi<{}, ExploreResponsePayload>({
+      method: 'GET',
+      endpoint: 'api/v1/explore/',
+    })(exploreUrlParams);
+    if (isResult(rv)) {
+      return rv;
+    }
+    throw loadErrorMessage;

Review Comment:
   ```suggestion
       throw new Error(loadErrorMessage);
   ```
   
   I think we throw error objects instead of strings



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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920823022


##########
superset-frontend/cypress-base/cypress/integration/explore/link.test.ts:
##########
@@ -28,7 +28,7 @@ import { HEALTH_POP_FORM_DATA_DEFAULTS } from './visualizations/shared.helper';
 const apiURL = (endpoint: string, queryObject: Record<string, unknown>) =>
   `${endpoint}?q=${rison.encode(queryObject)}`;
 
-describe('Test explore links', () => {
+describe.skip('Test explore links', () => {

Review Comment:
   temporarily skip this test, will reenable after the [PR](https://github.com/apache/superset/pull/20704).



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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920104645


##########
superset-frontend/src/explore/ExplorePage.tsx:
##########
@@ -33,11 +40,35 @@ import { fallbackExploreInitialData } from './fixtures';
 
 const loadErrorMessage = t('Failed to load chart data.');
 
-const fetchExploreData = (exploreUrlParams: URLSearchParams) =>
-  makeApi<{}, ExploreResponsePayload>({
-    method: 'GET',
-    endpoint: 'api/v1/explore/',
-  })(exploreUrlParams);
+interface ResultInterface {
+  result: {
+    form_data: QueryFormData;
+    slice: Slice;
+    dataset: Dataset;
+  };
+}
+
+const isResult = (rv: JsonObject): rv is ResultInterface =>
+  rv?.result?.form_data &&
+  rv?.result?.slice &&
+  rv?.result?.dataset &&
+  isDefined(rv?.result?.dataset?.id) &&
+  isDefined(rv?.result?.dataset?.uid);
+
+const fetchExploreData = async (exploreUrlParams: URLSearchParams) => {
+  try {
+    const rv = await makeApi<{}, ExploreResponsePayload>({
+      method: 'GET',
+      endpoint: 'api/v1/explore/',
+    })(exploreUrlParams);
+    if (isResult(rv)) {
+      return rv;
+    }
+    throw loadErrorMessage;

Review Comment:
   done



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


[GitHub] [superset] kgabryje commented on pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
kgabryje commented on PR #20699:
URL: https://github.com/apache/superset/pull/20699#issuecomment-1183594036

   Pushed a fix - we shouldn't check if slice is null. It is expected that slice is null when user creates a new chart


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


[GitHub] [superset] zhaoyongjie merged pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie merged PR #20699:
URL: https://github.com/apache/superset/pull/20699


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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r919999145


##########
superset-frontend/src/explore/actions/hydrateExplore.ts:
##########
@@ -55,8 +55,7 @@ export const hydrateExplore =
     if (dashboardId) {
       initialFormData.dashboardId = dashboardId;
     }
-    const initialDatasource =
-      datasources?.[initialFormData.datasource] ?? dataset;
+    const initialDatasource = dataset;

Review Comment:
   `fallbackExploreInitialData` handle this case. There should be some refactoring going on here, so keep this variable for now.



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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920002972


##########
superset-frontend/src/explore/ExplorePage.tsx:
##########
@@ -33,11 +40,35 @@ import { fallbackExploreInitialData } from './fixtures';
 
 const loadErrorMessage = t('Failed to load chart data.');
 
-const fetchExploreData = (exploreUrlParams: URLSearchParams) =>
-  makeApi<{}, ExploreResponsePayload>({
-    method: 'GET',
-    endpoint: 'api/v1/explore/',
-  })(exploreUrlParams);
+interface ResultInterface {
+  result: {
+    form_data: QueryFormData;
+    slice: Slice;
+    dataset: Dataset;
+  };
+}
+
+const isResult = (rv: JsonObject): rv is ResultInterface =>
+  rv?.result?.form_data &&
+  rv?.result?.slice &&
+  rv?.result?.dataset &&
+  isDefined(rv?.result?.dataset?.id) &&
+  isDefined(rv?.result?.dataset?.uid);

Review Comment:
   The same logic as before. I will improve this type and code style in the future.



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


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #20699: fix: columns are lost when dashboard to explore

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #20699:
URL: https://github.com/apache/superset/pull/20699#discussion_r920002972


##########
superset-frontend/src/explore/ExplorePage.tsx:
##########
@@ -33,11 +40,35 @@ import { fallbackExploreInitialData } from './fixtures';
 
 const loadErrorMessage = t('Failed to load chart data.');
 
-const fetchExploreData = (exploreUrlParams: URLSearchParams) =>
-  makeApi<{}, ExploreResponsePayload>({
-    method: 'GET',
-    endpoint: 'api/v1/explore/',
-  })(exploreUrlParams);
+interface ResultInterface {
+  result: {
+    form_data: QueryFormData;
+    slice: Slice;
+    dataset: Dataset;
+  };
+}
+
+const isResult = (rv: JsonObject): rv is ResultInterface =>
+  rv?.result?.form_data &&
+  rv?.result?.slice &&
+  rv?.result?.dataset &&
+  isDefined(rv?.result?.dataset?.id) &&
+  isDefined(rv?.result?.dataset?.uid);

Review Comment:
   The same logic as before. I will improve this type and code style in the future.



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