chore(webapp): scope imperative component refs - #4730
Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| }, []); | ||
|
|
||
| // Compute current save data for the save render prop | ||
| // oxlint-disable-next-line react/react-compiler -- This ref intentionally coordinates an imperative integration outside React state. |
There was a problem hiding this comment.
🔍 Suppression masks a genuine render-phase ref read that can render stale/empty query text
These new oxlint-disable comments silence the react-compiler rule for editorRef.current?.getQuery() calls that happen during render (apps/webapp/app/components/query/QueryEditor.tsx:566, :795, :850, :900, :963). Unlike the other sites in this PR (which just assign the latest value to a ref during render — a benign latest-value pattern), these actually read an imperative handle during render: on the first render editorRef.current is null, and afterwards the value is not reactive, so the rendered query prop can lag behind the editor's real content until an unrelated re-render occurs. The fallbacks (?? defaultQuery, ?? "") hide this rather than fix it. Suppressing the rule here removes the only signal pointing at that latent staleness; a follow-up that lifts the query text into state (or passes a getter down) would be preferable.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Scopes React Compiler diagnostics to component and hook statements where refs intentionally coordinate editors, animations, polling, deferred callbacks, and other imperative integrations. Other compiler diagnostics remain active in those components.