Address remaining React hooks lint warnings in LiveProvider and Editor
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- react, typescript
Research direction
Start with the LiveProvider tests that currently cover only code changes, then inspect the LiveProvider and Editor entry points alongside .oxlintrc.json. Add coverage for changes to scope, noInline, transformCode, and enableTypeScript, then address the remaining warnings while preserving the contentEditable controlled/uncontrolled contract; consider #415 first.
Written by the indexing model from the issue text.
Description
Five oxlint warnings remain, set to warn in .oxlintrc.json.
LiveProvider effect deps
useEffect(() => {
transpileAsync(code).catch(onError);
}, [code, scope, noInline, transformCode]);
Do not apply the suggested fix as-is. The linter calls scope, noInline, and transformCode unnecessary because they are not in the effect body. They are used by transpileAsync, which closes over them. Removing them stops re-transpiling when scope or transformCode changes.
Real bug the linter misses: transpileAsync also closes over enableTypeScript, which is not in the deps, so toggling it at runtime does not re-transpile.
Fix: make transpileAsync a useCallback with deps scope, noInline, transformCode, enableTypeScript, and depend on it. Changes when transpilation runs, notably for an inline scope={{ ... }}.
jsx-no-constructed-context-values
New context object every render re-renders all consumers. Needs useCallback on onError/onChange as well as useMemo, and onChange depends on transpileAsync — so entangled with the above.
set-state-in-effect in Editor
useEffect(() => setCode(props.code), [props.code]) syncs state from props. Both standard fixes change the controlled/uncontrolled contract of a contentEditable editor.
Order
- Add tests that changing
scope,noInline,transformCode, andenableTypeScriptre-transpiles. Onlycodeis covered today. TheenableTypeScriptone should fail, confirming the bug above. - Fix the stale closure.
useCallback/useMemorefactor.Editorprop sync, separately.
Worth holding until #415 is understood.
- Dominant language
- TypeScript
- Stars
- 4.6k
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FormidableLabs/react-live
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
FormidableLabs/react-live#419 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
FormidableLabs/react-live#415 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
FormidableLabs/react-live#413 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
FormidableLabs/react-live#411 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
FormidableLabs/react-live#410 · 1 comment ·
All issues in FormidableLabs/react-live
Similar issues
-
S: triage
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
snapshot-labs/stamp#666 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GauravKarakoti/SecureFlow#1070 · 1 comment ·
-
feature:Languages/Translations good first issue ready Web
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
digitalfabrik/integreat-app#4394 ·