rlei-odes commented on PR #43228:
URL: https://github.com/apache/superset/pull/43228#issuecomment-5307290914
Good catch — this was a real regression, thank you.
`ADD_CHART` builds its entry from defaults and takes no `state` argument, so
it
is dispatched for a key that is deliberately not in the store yet. My guard
dropped exactly those actions, which stopped charts being added at all. I
confirmed it before fixing:
```
expect(received).toBeDefined()
Received: undefined
```
Fixed by exempting `ADD_CHART`. I used the imported `actions.ADD_CHART`
constant
rather than a `'ADD_CHART'` string literal, so a rename cannot silently
reintroduce the bug:
```ts
if (action.type !== actions.ADD_CHART && !charts[action.key]) {
return charts;
}
```
I have also added a test for the add path, since the gap that let this
through
was that nothing covered `ADD_CHART` against a state without that key. The
suite
now pins both directions — an action for a departed chart is ignored, and a
new
chart is still added.
`npx jest src/components/Chart src/dashboard/reducers src/explore/reducers`:
27 suites, 246 passed.
--
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]