-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
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
Create a mechanism in Flow that allows creating elements in the client-side memory from server-side without attaching them to the DOM #2826
Comments
I think we can do this via the same way as Also we can decide to postpone this until server-side/client-side communication refactoring is done (which we would like to do and it's theoretically should be done at some point). |
Doesn't |
Yes, Technically we can execute JS from the server side at any point. That's done with If there shouldn't be a response to the server then just don't do it in this impl. |
I'm not entirely sure that I understand the requirements in the ticket.
So technically I don't see why you need any additional functionality from the engine. It's possible to do everything via JS already now. But that won't be possible if you want to add/append server-side components into the pure-client side element. So please clarify the usecases/requirements. |
And by the way : do you need the container as a DOM element? |
This is directly based from the needs or the component renderer:
Compared to the current implementation, this would help us get rid of the dummy container element to which the elements are currently temporarily attached. |
So the main need is : have an Several observations:
What could be done theoretically:
The only issue here is: the server side element is still the child of its parent and it's not removed. It would be good to avoid creating a dedicated feature for this usecase. And do everything via JS only. But I don't see how it can be done because we need the node attached which means it should be in some feature to be sent to the client. So technically it's just about creating one more feature which is handled almost in the same way as |
The entire point of this ticket is to get rid of the runtime overhead of attaching the element to the client-side DOM multiple times. It might be possible to reuse the existing |
Yeah, I've been thinking about this. |
Could maybe also be possible to slightly modify the current users of |
To be able to fix this ticket and reimplement two features (which we are currently experiencing problems with) I suggest:
But I suggest to use
Generally on the client side the virtual children should be handled in the same way from the point of view of structure. The only difference is : mapping the DOM node and the |
We should not modify |
OK, using So it looks like it would be better to create a fake interim |
See also #3078 for JS API. |
This is related to the current implementation of
ComponentRenderer
s introduced in #2720.The problem:
Currently the each component generated by a
ComponentRenderer
is created at the server-side and attached to a specific container at the client-side. And a special webcomponent, called<flow-component-renderer>
, which stamped via a<template>
, knows how to fetch items from this specific container and place the components at the right place.The problem is that this container is a node inside the DOM tree, that can be manipulated and even removed by any other script in the page, making it potentially unstable. It also pollutes the client-side tree just to provide a way to the webcomponent to fetch the right items.
Example (after the
<template>
is stamped):The internal implementation of the
<flow-component-renderer>
makes it look for the container with id123-456
and fetch the component with the attributeitemkey="1"
and add it as its child element.A possible solution:
A better approach would be to create the element at the server side and store it in the memory of the client-side engine, without attaching it to the DOM. A function would be then exported by the client engine to enable the webcomponent to fetch the desired element without consulting the DOM tree.
That would make it easier to cleanup the state as well, once the components are not needed anymore.
There's no clear way on how to do this with Flow currently. There's no documentation on how the client engine operates and how the elements from server to client are bound together. So the idea is to provide a protocol to make this kind of implementation to work without the container workaround. Ideally, all the Element API for the rendered component should work out-of-the-box, so all the features for Components would just work without extra effort from the end user.
The text was updated successfully, but these errors were encountered: