i'm loving om.next -- what is its future?
Om.After.Next
Then Om.Beyond.After.Next
Then Om Next colonizes Mars.
The end.
Hi, I am developing a project with om.next these days, and getting confused about the query concept, and get some following questions: 1. In what kind of situation should I define the query in read function in parser, I found in the examples, not all query in component is defined in the read function, so what's the principle? 2. how should we pass the data to children components. Organize the data following the structure of components and passing them through each level?
I've never seen a query defined in the read parser, but you can query the read parser from om/IQuery method. You can also query all sorts of objects that are passed to the component if they exist in the parent component but not in the read parser. You can do all sorts of normalization and joins just with how you query. I would always have a read key in the read parser available for every read, or have a default method on read (just get the key from the component state (in env)) and you can save some typing.
@hlolli Yes, we can get the data passed to the component from its parent component, with its query not defined in the read parser, and I also define almost every query in the read parser, but no idea when it's necessary to define query in read parser, when not
@joseph in my experience (havent read the source code alot), you can somethimes pass data from parent component without needing to query its key, but as soon as you are passing a key to a child component that exists in read and there's any change in the global state, you will loose all the data if its unqueried. I would be careful about data passed down that's unqueried and look after the possibility that you could loose data from a component that way.