Nodes' data structure #6601
-
I want to decide on my nodes' structure and thinking about namespacing my variables in a field named __meta (or __data) so that all the values will be accessed and mutated like, say, __meta.xOffset, __meta.componentToRender etc. I've extensively studied the docs and lexical-playground examples. Is this a good approach considering my reasoning below, or should I just stick to the existing examples? Is there anything I might be missing architecture-wise, performance-wise, state-management-wise, lexical-internal-stuff-wise or whatever-wise? Part of my reasoning:
Any other pros and cons, or architectural recommendations are welcome. (Just such a wonderful library, have fully migrated to it and been building on it. Now trying to decide on a robust architecture.) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
Thank you. That answers all my questions. Just to provoke further valuable advice:
Regarding point 1, I also had thought of using single underscores, but in the lexical docs there was the part above (regarding the tooling) about the double underscore convention. So, I thought, single underscore might be better to avoid. But I get the point. And the worry that I had about refactoring is not about app refactoring, which we are fine with. It is about the would-be inconsistency between node fields and serialized data that will have been stored in the db. (But that is not a big deal, since, I guess, that should be taken as a given and lexical provides very convenient import export methods anyway.) Special thanks for the third point. I am sure that would have tripped us over down the road, had I not asked this question. Again regarding my third question but from design perspective to invoke knowledge and experience (perhaps also a little) beyond lexical scope: (I would greatly appreciate any other relevant advice, but I got the answer to my original question.) |
Beta Was this translation helpful? Give feedback.
__meta
object is not shared across versions of that node (e.g.this.__meta = {...p…