[WIP]chore: validate VChart with VRender alpha.8#4574
[WIP]chore: validate VChart with VRender alpha.8#4574xuefei1313 wants to merge 4 commits intodevelopfrom
Conversation
Use the published VRender alpha.2 packages for the VChart validation branch. Keep the minimal app-aware stage path and external ownership fixes in review scope. Add regression coverage for VRender patches and final attrs. Constraint: Published npm alpha is the validation source Constraint: option.stage and option.app remain external-owned Rejected: Local linked VRender build | final evidence must use npm alpha Rejected: Broad env/bootstrap migration | this branch keeps stage changes minimal Confidence: high Scope-risk: moderate Directive: Do not downgrade @visactor/vrender* or bypass VRender state patches Tested: rush install --check-only Tested: rush test --only @visactor/vchart Tested: rush build --to @visactor/vchart Tested: eslint touched VChart files Tested: browser strict smoke for basicBar/basicLine/textHeavy hover/select Not-tested: full miniApp/wx/tt/harmony/lynx app factory migration
Use root app factories for VChart-created stages. Publish ordinary mark state styles as shared VRender state definitions. Keep external stage and app ownership outside VChart release. Constraint: Do not modify VRender or use local VRender2 links Constraint: Keep this as a minimal VChart migration Rejected: Manual app bootstrap | root VRender app creators are public API Rejected: stateProxy normal path | VRender now owns resolvedStatePatch Confidence: high Scope-risk: moderate Directive: Do not use direct addState/removeState for VChart state changes Tested: install --check-only Tested: test --only @visactor/vchart Tested: build --to @visactor/vchart Tested: eslint touched VChart files Not-tested: Browser smoke lacked a local browser driver or harness
Consume published VRender alpha.8 packages for PR validation. Refresh VChart direct deps and Rush lockfile only. Constraint: Use npm registry @visactor/vrender*@1.1.0-alpha.8. Constraint: No local VRender2 link, file, workspace, yalc, or pack. Rejected: Local VRender2 linking | PR must test published packages. Confidence: high Scope-risk: moderate Directive: Keep VRender release validation on npm artifacts. Tested: rush update; rush install --check-only. Tested: rush test --only @visactor/vchart. Tested: rush build --to @visactor/vchart; browser smoke.
|
🦞 Aime Bot Review 改动摘要:升级所有直接使用 VRender 的依赖版本到 1.1.0-alpha.8,并刷新 Rush pnpm-lock;引入 stage-app 抽象,通过 VRender App 创建和复用 Stage,区分外部 stage 和内部 stage 的生命周期;将 mark、interaction、brush、sankey 等位置的状态切换统一封装到 addGraphicState/removeGraphicState,适配 VRender 1.1 的 useStates/sharedStateDefinitions;为状态补丁和 stage/app 生命周期补充了单元测试。 代码层面观察与建议:1)VRender App 和 Stage 管理方面,Compiler.initStage 通过 resolveVRenderApp 和 createStageFromApp 支持外部 app 与内部 fallback app 复用,并在 release 中基于 _isExternalStage 决定是否释放 stage,同时释放 releaseVRenderAppRef 以回收默认 app,整体设计清晰,生命周期划分合理;外部 stage 场景下仅移除 rootGroup 而不释放 stage 本身符合期望,请确认外部传入的 stage.defaultLayer 一定存在且 rootGroup 总是挂在 defaultLayer 上,否则 removeChild(rootGroup) 可能无效或抛错。2)共享状态定义与状态补丁方面,BaseMark._applySharedStateDefinitions 将 encoderOfState(排除 group/update)转成 sharedStateDefinitions,并根据 _stateSort 计算 priority,resolver 中直接调用 _runEncoderOfGraphic,配合 _initGraphicState 中移除 stateProxy、改用 useStates,能够让 VRender 负责状态补丁合成;新增的 vchart-event.test 针对柱图、折线图和 customMark 的交互状态验证了 sharedStateDefinitions.resolver 和 resolvedStatePatch 与 attribute 的行为,看起来覆盖了主要路径,请确认在存在多个状态同时生效的场景(例如 hover 加 selected)时,VRender 对 sharedStateDefinitions.priority 的合并顺序与之前手动合并 encoder 的语义保持一致,避免样式覆盖顺序发生变化。3)graphic 状态封装方面,addGraphicState/removeGraphicState 统一通过 graphic.useStates 驱动状态切换,并基于 currentStates 做去重和过滤,能够减少直接操作 addState/removeState 的分支逻辑,Interaction、Brush、SankeySeries 以及各类 element 触发器均已切换到该工具函数,实现上没有发现明显遗漏,语义上也与原有逻辑一致,请确认 runtimeState 与交互状态组合使用时,currentStates 与 runtimeStateCache 的配合在 VRender 1.1 下不会产生意外的状态残留。4)stage 和 app 复用与释放策略方面,stage-app 中通过 defaultVRenderApps 和 refCount 复用默认 app,并在最后一个使用者释放时调用 app.release,配合 getDefaultVRenderApp 的已释放则重新创建逻辑,整体符合预期,vchart.test 中针对外部 stage 复用、外部 app 创建 stage、fallback app 生命周期以及 DOM 渲染路径的用例比较完善,能够较好防止回归。测试与验证:本次改动中新增加和更新的单测(vchart-event.test.ts、vchart.test.ts)覆盖了状态补丁、sharedStateDefinitions 以及 stage/app 生命周期的关键路径,覆盖范围看起来比较合理,Notes 中列出的安装、单测、构建与浏览器冒烟验证步骤建议在后续 Ready 阶段持续执行,以确保在大图集下也没有兼容性回归。合并建议:当前 PR 标题标记为 WIP,且主要目的是验证 VChart 在 VRender 1.1.0-alpha.8 下的完整渲染链路,基于当前改动与用例,新实现整体合理,未发现明显阻塞问题;由于处于 WIP 状态,暂不给出合并建议,待后续标记为 Ready 并完成一轮完整渲染回归后再评估是否可合入。 |
Add deterministic regression coverage for VRender alpha animation behavior. It exercises VChart with ManualTicker instead of browser timing. Constraint: Uses npm VRender through VChart exports. Confidence: high Scope-risk: narrow Tested: eslint touched animation test --quiet Tested: jest manual-ticker.test.ts --runInBand --silent=false Tested: rush test --only @visactor/vchart Tested: rush install --check-only Tested: rush build --to @visactor/vchart
Summary
Verification
Notes