ant-design / ant-design/cssinjs

useHMR throws in SSR when when dev-server hot reloading is enabled

Open
#133 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
287
Forks
80
PR merge metrics
No merged PRs in 30d

Description

image

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.