delete the orphaned build script, and fix the second copy of the memo rule
scripts/build/runtime.ts had no caller after the build:editor scripts went. Its own usage text gives away where it came from: --experiments, --tracking, --editor-setup, the same phantom domain as the docs and examples cleaned up earlier. Nothing else references it — the `./runtime` export in src/workspaces/types/package.json points at a different file, which is untouched. helpers.ts stays; dashboard.ts and web.ts import it. APP_CONVENTIONS.md carried its own copy of "React 19's compiler handles memoization. Never use useCallback or useMemo." Correcting only CONVENTIONS.md would have left the two contradicting each other, which is worse than either. Both now say the same thing and one points at the other for the reasoning. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -97,9 +97,15 @@ Within a file, order sections as:
|
||||
5. Types (props types for sub-components)
|
||||
6. Helper components / functions
|
||||
|
||||
## No useCallback or useMemo (React 19)
|
||||
## Prefer plain values over memoization
|
||||
|
||||
React 19's compiler handles memoization. Never use `useCallback` or `useMemo`.
|
||||
Default to writing derivations plainly — most are cheap, and the memo costs more than the work. But
|
||||
`useMemo`/`useCallback` are ordinary tools, not forbidden ones: reach for them when a value or callback
|
||||
feeds a dependency array, when a computation is genuinely expensive, or when the prop goes to a memoized
|
||||
child. See `CONVENTIONS.md` for the full rule and why the old "never, React 19 handles it" version was
|
||||
wrong — the React Compiler is opt-in and is not installed here.
|
||||
|
||||
The examples below are still the right default shape:
|
||||
|
||||
```tsx
|
||||
// Plain function — not wrapped in useCallback
|
||||
|
||||
Reference in New Issue
Block a user