You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the ClientQueryBuilder class, why not expose the current Q Query and a reference to the client, so it could be simplified further to:
useQuery(triplit.query('directors').include('allFilms',(rel)=>rel('allFilms').include('actors'))// no build() or client ref required as it can be accessed from class);
& since useQuery is a react-specific hook, and thus made specifically to provide an easier/better interface over triplit, it would make sense to go further react-y and use the context/provider pattern:
useQuery("directors",(q)=>q.include("allFilms",(rel)=>rel("allFilms").include("actors"))// triplit client is provided by the TriplitProvider);
Final Diff:
useQuery(triplit,triplit.query('directors').include('allFilms',(rel)=>rel('allFilms').include('actors').build()));// vs useQuery("directors",(q)=>q.include("allFilms",(rel)=>rel("allFilms").include("actors")));
The text was updated successfully, but these errors were encountered:
I like your idea! Especially the query builder callback ((q) => q.include(allFilms"....) Have you tried implementing this in "userland"? Seemingly only thing that would need to change is the @triplit/react package.
In a query like this:
In the
ClientQueryBuilder class
, why not expose the currentQ
Query and a reference to the client, so it could be simplified further to:& since
useQuery
is a react-specific hook, and thus made specifically to provide an easier/better interface over triplit, it would make sense to go further react-y and use the context/provider pattern:& in the components:
Final Diff:
The text was updated successfully, but these errors were encountered: