定义 effect cleanup 生命周期 / Define the effect cleanup lifecycle - #22
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文
用户可见结果
state_effect("name", deps) { ... },用于 focus、flash、日志等无需释放资源的 render 后工作。state_resource(name = ..., deps = ..., cleanup = ..., action = ...),让 subscription、observer、timer handle 等 setup/cleanup 在严格类型下保持清晰,不要求 callback 返回两种不同形状。安全与生命周期
component(...)unmount 与reset_feature(...)会释放对应 live resources。feature_root(...)仅因 route 暂时隐藏时保留 snapshot 与 live resource;显式 reset/runtime dispose 才释放。[explore-react effect]日志且不会阻断后续 setup/boot。文档
docs/effect-lifecycle.md,完整说明 author API、生命周期顺序、persistent feature policy 与 HMR hand-off。验证
yarn test:kokayarn buildyarn check关联 issue
Closes #18
English
User-visible result
state_effect("name", deps) { ... }form for focus, flash, logging, and other post-render work with nothing to release.state_resource(name = ..., deps = ..., cleanup = ..., action = ...)so subscriptions, observers, timer handles, and other setup/cleanup lifecycles stay explicit under strict typing without requiring one callback to return two different shapes.Safety and lifecycle
component(...)unmount andreset_feature(...)release their corresponding live resources.feature_root(...)retains both snapshot and live resource while temporarily hidden by routing; explicit reset or runtime disposal releases it.[explore-react effect]and cannot block the following setup or boot.Documentation
docs/effect-lifecycle.mdwith the complete author API, lifecycle order, persistent-feature policy, and HMR hand-off contract.Verification
yarn test:kokayarn buildyarn checkRelated issue
Closes #18