apache / apache/superset

Warning toasts in downloadAsPdf.ts / downloadAsImage.tsx never render (unbound action creator)

Closed Beginner friendly
#44,153 1 comment 0 reactions 0 assignees View on GitHub
preset-io
Dominant language
Python
Stars
74.8k
Forks
18.3k
Avg merge
2d 7h
Merged PRs (30d)
692

Description

Follow-up from #44031 (h/t @gabotorresruiz for the catch).

`src/utils/downloadAsPdf.ts` and `src/utils/downloadAsImage.tsx` both import
`addWarningToast` directly from `src/components/MessageToasts/actions`
instead of a dispatch-bound callback:

- `downloadAsPdf.ts:59` returns the raw action object from its event handler;
every caller discards it, so nothing reaches the toast reducer.
- `downloadAsImage.tsx:391,436,536,617` calls the raw creator and drops the
result in all four places.

Same root cause #44031 fixed for `exportPivotExcel`: these creators are
plain object factories with no dispatch of their own, so the missing-element
warning toast silently never renders in either file.

Fix is the same bound-callback pattern landed in #44031: accept an optional
`addWarningToast` callback bound via `useToasts()` / `bindActionCreators` at
each call site, with a test asserting the toast actually fires.

Contributor guide

Open the contributing guide

Research direction

Start by reading the bound-callback fix for exportPivotExcel in #44031, then inspect src/utils/downloadAsPdf.ts:59 and src/utils/downloadAsImage.tsx at lines 391, 436, 536, and 617. Update the callers consistently and add a focused test asserting that the missing-element warning toast fires in both utilities.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.