sunmao-ui/packages
Yanzhen Yu b5df69f21c perf(runtime): refactor the slot's props and fallback implementation
The main idea of this patch is to set slot props to a reactive store
instead of passing them as React props to the slot children elements.

Same as other state management in sunmao, the component will subscribe
to the slot store to get the latest value of slot props.

Same as component id, we need a way to identify every slot props in the store.
So we add a new parameter key to the `getSlot` function,
where [component id, slot name, key] will be a unique identifier.

Another challenge is to subscribe the slot store in a efficient way.
Currently we are using vue's reactivity system, which need set `deep: true`
to observe multiple value during effect.

By setting `deep: true`, if we write code like `const $slot = slotStore[slotKey]`,
it will subscribe all the sub-fields of this slot key be cause we 'access' the property.

The solution is to implement a redirector Proxy.
With the redirector, expression `$slot.a.b` will be redirect to `slotStore[slotKey].a.b`.

related to: #388
2022-08-23 10:26:18 +08:00
..
arco-lib fix: fix the exampleProperties type errors 2022-08-16 11:52:16 +08:00
chakra-ui-lib perf(runtime): refactor the slot's props and fallback implementation 2022-08-23 10:26:18 +08:00
core Merge pull request #568 from smartxworks/fix/windlike-dev 2022-08-16 15:39:06 +08:00
editor fix: fix selecting component would change the properties' values issue 2022-08-17 10:09:24 +08:00
editor-sdk fix(SpaceWidget): fix padding display misalignment 2022-08-17 17:50:40 +08:00
runtime perf(runtime): refactor the slot's props and fallback implementation 2022-08-23 10:26:18 +08:00
shared Merge pull request #568 from smartxworks/fix/windlike-dev 2022-08-16 15:39:06 +08:00
vite-plugin-fs chore(*): publish 2022-07-18 17:27:57 +08:00
vite-plugins chore(*): publish 2022-07-18 17:27:57 +08:00