docs(tests): explain React fixture timing and render counters
This commit is contained in:
@@ -9,7 +9,8 @@ import { defineComponent, editable, movable } from '@/lib/canvas-core/index';
|
||||
import type {ReactFlowProjectionNode as ProjectionNode,ReactFlowProjectionEdge as ProjectionEdge} from '@/lib/canvas-bindings/react-flow';
|
||||
import type { CanvasRuntimeExtension } from '@/lib/canvas-bindings/react-flow';
|
||||
import { useCanvasBinding,useElement, useCanvasRendererCommands } from '@/lib/canvas-bindings/react-flow';
|
||||
// 按元素 ID 计数真实 renderer 调用,供外层检查无关元素是否重渲染,不以 DOM 数量代替渲染次数。
|
||||
// 按元素 ID 计数 renderer 函数调用,供外层检查无关元素是否重渲染,不以 DOM 数量代替渲染次数。
|
||||
// 计数发生在 render 阶段,可能含 StrictMode/重试调用,不等于 DOM 提交次数;外层应比较受控操作前后增量。
|
||||
function rendered(id:string){const host=globalThis as typeof globalThis&{__fixtureRenders?:Record<string,number>};const counts=host.__fixtureRenders??={};counts[id]=(counts[id]??0)+1;}
|
||||
// 通过 useElement 取得当前原记录,捕获有 scoped target 与无绑定两种旧 editing facade,交给外层验证桥接隔离。
|
||||
function Meter({data}:NodeProps<ProjectionNode>){
|
||||
|
||||
Reference in New Issue
Block a user