rusackas opened a new pull request, #40027:
URL: https://github.com/apache/superset/pull/40027
### SUMMARY
First step of #39927 (the react-redux v7 → v8 migration spun off from
#39890).
Adds typed Redux hooks alongside the existing store export in
\`src/views/store.ts\`:
\`\`\`ts
export type AppDispatch = typeof store.dispatch;
export const useAppDispatch: () => AppDispatch = useDispatch;
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
\`\`\`
This is **purely additive** — no existing call sites changed. The hooks work
identically under react-redux v7 (current) and v8 (target). Landing them now
means subsequent PRs can migrate \`useDispatch\` → \`useAppDispatch\` one
feature area at a time, instead of one mega-PR alongside the v8 bump.
### Why now
The eventual v8 bump tightens \`useDispatch\` / \`connect\` typing so thunks
no longer auto-resolve against \`Dispatch<AnyAction>\`. A spot-check from
#39927 surfaced ~50 new TS errors in just three SqlLab files; the real
migration surface is hundreds of call sites. Defining the typed hooks first
lets that migration happen incrementally and reversibly.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — no runtime change; typed-hook exports only.
### TESTING INSTRUCTIONS
1. Pre-commit Type-Checking hook passes (\`pre-commit run --files
superset-frontend/src/views/store.ts\`).
2. \`useAppDispatch\` and \`useAppSelector\` are importable from
\`src/views/store\`. Try in a scratch file:
\`\`\`ts
import { useAppDispatch, useAppSelector } from 'src/views/store';
\`\`\`
3. No existing test should change behavior — diff is additive only.
### ADDITIONAL INFORMATION
- [x] Has associated issue: #39927 (sub-issue of #39890)
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] 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: [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]