Skip to content

finding(react): three more react-hooks/refs warnings on published hooks — useETagCache, useGlobalUndo, useOffline #6797

Description

@claude

Found by the domain:ui execution seat while implementing objectui#6745 (the
same rule on useSchemaPersistence). Not fixed there — that PR is scoped to one
file, and widening it silently would have put four hooks' worth of timing
analysis behind one card's review.

What ESLint reports

Measured on d06059f24 (the base of objectui#6745's branch):

pnpm exec eslint packages/react --format json
=> 126 files, 0 errors, 346 warnings, of which 6 are react-hooks/refs

Three of those six were useSchemaPersistence and are gone with objectui#6745.
The remaining three, each Cannot access refs during render, are one apiece on:

packages/react/src/hooks/useETagCache.ts:204
packages/react/src/hooks/useGlobalUndo.ts:57
packages/react/src/hooks/useOffline.ts:262

Why it may matter

Same reasoning as objectui#6745: a ref read or written during render is not safe
under concurrent rendering, because a render React discards or replays still
performed the access. Whether that is reachable here depends on what each ref
holds and who reads it — that analysis has not been done for these three,
and the fix that worked for useSchemaPersistence (moving the write to
useInsertionEffect to keep the commit-phase timing) may or may not be the right
shape for them.

pnpm lint is green (0 errors), so nothing is red today, and no user-visible
break has been measured. Filing as an observation for triage, not asserting
impact.

Reproduce

pnpm exec eslint packages/react/src/hooks/useETagCache.ts packages/react/src/hooks/useGlobalUndo.ts packages/react/src/hooks/useOffline.ts --format json

Dedupe

/search/issues answers 403 for this seat, so this went through the REST list
endpoint plus a local grep: 242 open issues collected, zero hits for
useETagCache, useGlobalUndo, useOffline, react-hooks/refs or "ref during
render" other than objectui#6745 itself. Control terms hit in the same read
(objectui#6745's own title matched, and "hook" matched 2 titles), so the empty
result is a real reading rather than a broken one.


Generated by Claude Code

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpriority:p2

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions