sadpandajoe commented on code in PR #43805:
URL: https://github.com/apache/superset/pull/43805#discussion_r3953213414
##########
superset-frontend/src/dashboard/components/menu/DownloadMenuItems/index.tsx:
##########
@@ -167,6 +211,75 @@ export const useDownloadMenuItems = (
}
};
+ const pollExportStatus = (jobId: string, pollState: ExportPollState) => {
+ if (unmountedRef.current) {
+ return;
+ }
+ SupersetClient.get({
+ endpoint: `/api/v1/dashboard/export_xlsx/status/${jobId}/`,
+ })
+ .then(({ json }) => {
+ // A response in flight when the component unmounts must not navigate
+ // (redirect) or toast on whatever page the user moved to.
+ if (unmountedRef.current) {
+ return;
+ }
+ const {
+ status,
+ download_url: downloadUrl,
+ message,
+ } = json as ExportStatusResponse;
+ if (status === 'ready') {
+ if (downloadUrl) {
+ redirect(downloadUrl);
Review Comment:
A ready status only proves the link record exists; the object can still be
removed before this navigation, and the download endpoint then returns a JSON
410/501. `redirect()` replaces the dashboard with that error response, so a
guest/Public user loses the page instead of getting a retryable failure. Could
this fetch the download and surface an error toast without navigating away when
the stream cannot start?
--
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]