Reputation: 625
In some parts of my app, I have a component using a fragment. but up the tree somewhere, i sometimes need to create temporary objects waiting to be synced with the server (once they will they are transformed as plain relay objects).
But until then, they are only a few objects passed down the tree of component.
The createFragmentContainer
+ some @relay(mask: false)
make all this possible.
But I would like to make it a bit cleaner using useFragment
.
Usefragment doesn't like at all the "fake fragment" data.
Is there a way to somewhat legibly hydrate a fragment from data not directly coming from a query?
or maybe another way?
Upvotes: 1
Views: 332
Reputation: 625
The best idea seems to go with commitLocalUpdate you can even create new types for your need
https://relay.dev/docs/v10.1.3/mutations/#using-updater-and-optimisticupdater
Upvotes: 0