Allow isolated, nameless components, introduce 'component_'#905
Conversation
This allows us to generate component names on user's behalf when they do no need inter component communication. - Add global IORef of component IDs, w/ fresh component Id - If user doesn't give an ID, then generator one from the global ref - Add component_ smart constructor - Update documentation, removed old comments
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Now that components are here, we must keep events from bubbling up out of their respective sub trees into the parent sub tree.
- If a Component is named by a user (not auto-generated) we can use that as a stable name during diffing. Otherwise, user's must rely on key_ (via embedKeyed) as a stable name for Component replacement.
|
A "nameless component" is a Normally when diffing, we can just replace two nodes if they have different tags, types, keys or Now, if we allow users to omit the So here's what I think might be best. Since I added a test w/ But the tldr; is that we're going to have to tell users that if they think it's possible their This is an edge case, and it most likely won't happen often, when in doubt, name your components (use |
- If we have a 'vcomp', 'data-component-id' will always be set.
This allows us to generate component names on user's behalf when they do not need inter-component communication.
IORefof component IDs, w/ fresh component Idcomponent_smart constructorsetBodyComponent->setComponentdelegatordiv_ [] [ embed (component_ app) ]