Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Frontend code review guidance from the Dify LLM application development platform repository.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/performance.md
1# Rule Catalog — Performance23## React Flow data usage45IsUrgent: True6Category: Performance78### Description910When rendering React Flow, prefer `useNodes`/`useEdges` for UI consumption and rely on `useStoreApi` inside callbacks that mutate or read node/edge state. Avoid manually pulling Flow data outside of these hooks.1112## Complex prop stability1314IsUrgent: False15Category: Performance1617### Description1819Only require stable object, array, or map props when there is a clear reason: the child is memoized, the value participates in effect/query dependencies, the value is part of a stable-reference API contract, or profiling/local behavior shows avoidable re-renders. Do not request `useMemo` for every inline object by default; `how-to-write-component` treats memoization as a targeted optimization.2021Update this file when adding, editing, or removing Performance rules so the catalog remains accurate.2223Risky:2425```tsx26<HeavyComp27config={{28provider: ...,29detail: ...30}}31/>32```3334Better when stable identity matters:3536```tsx37const config = useMemo(() => ({38provider: ...,39detail: ...40}), [provider, detail]);4142<HeavyComp43config={config}44/>45```46