We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新版本里useAyanami不支持传入scope了,是基于什么考虑去掉了这个特性呢?后续有没有替代方案支持组件间的数据隔离
The text was updated successfully, but these errors were encountered:
Scope 特性让 Ayanami 的底层设计变得非常复杂,并且会极大的影响 SSR 性能。 新版下数据隔离可以设计在 State 中,配合新增的 Selector API 可以做到更细粒度的组件更新控制:
Scope
SSR
State
Selector
interface ScopedState { foo: string bar: number } interface State { [index: string]: ScopedState } @Module('Somenamespace') class SomeModule extends Ayanami<State> { defaultState = {} } const { params: { id } } = useRouter() useAyanami(SomeModule, { selector: (state) => state[id], mutateStateOnFirstRendering: (state: Draft<State>) => { if (!state[id]) { state[id] = defaultState } } })
Sorry, something went wrong.
https://ayanami.observer/zh/recipes/state-selector
No branches or pull requests
新版本里useAyanami不支持传入scope了,是基于什么考虑去掉了这个特性呢?后续有没有替代方案支持组件间的数据隔离
The text was updated successfully, but these errors were encountered: