Component life cycle #516
Replies: 6 comments 12 replies
-
@mikko-ahonen Help me understand this better, how are you passing the querysets? From the example I cannot tell if you pass the |
Beta Was this translation helpful? Give feedback.
-
Not really. With server-side state I would understand that some entity would keep the state even without me saving it. What I would expect is that the parameters I pass to the component in the initialization could be also accessed when it is implicitly initialized through a view. So instead of get_context_data(), the parameter foo would be passed to init function (with double underscores) which could then set self.foo r that would be passes as the self.foo to the get function and get_context_data() |
Beta Was this translation helpful? Give feedback.
-
I guess in a way you could say Iam expecting component to keep state. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I was wondering about the version, to get a sense of how it could be implemented. Because in v0.81 we reworked the What we already do in the newer version is that we set the private For the UI component library, I would also need to access the slots from within So given these, I think what we could do is set all the render inputs (args, kwargs, slots, context) to the component instance for the duration of the full render, so we could access them as This is also similar to e.g. Vue, where one can access the inputs via One thing to note, we would have to also handle the case of when I would try to call @EmilStenstrom What do you think? |
Beta Was this translation helpful? Give feedback.
-
@JuroOravec did you have a chance to work on this? I was desperately needing it again today. The latest use case: When I need to pass the data through the form and requests, it would mean that I need to serialize and deserialize class name, id, field name. It would be way too unsafe -- I trust the template calling the component, but I don't trust the client. Also way too much boilerplate. |
Beta Was this translation helpful? Give feedback.
-
What kind of life cycle do the component instances have? Could I do something like this (does not appear to work)? In this case, this is a queryset, and I am passing two very different querysets from different places.
Beta Was this translation helpful? Give feedback.
All reactions