ant-design / ant-design/cssinjs
useHMR throws in SSR when when dev-server hot reloading is enabled
- Dominant language
- TypeScript
- Stars
- 287
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/ant-design/cssinjs/blob/55d57167648bd916a4fb4b4e48c729c918fb492e/src/hooks/useHMR.ts#L21
In this line, `window` might be changed to `globalThis` to support hot reloading in ssr, or add a condition `typeof window !== undefined` to keep it only hmr'ble on client
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with src/hooks/useHMR.ts at the linked line and inspect how the HMR hook accesses browser globals. Reproduce the failure with server-side rendering while dev-server hot reloading is enabled, then verify that the hook no longer throws in SSR and still supports client-side hot reloading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100