computed fields trigger refresh

When using the Gadget React client to perform a findMany query with the live flag enabled, I’ve noticed that computed fields based on related data are not updating in real-time. Only hardcoded fields seem to refresh as expected. Is this the intended behavior, or is there a way to ensure computed fields update live as well?
3 Replies
Chocci_Milk
Chocci_Milk6mo ago
Hello, Computed fields don't update in real time by design. It would cost the user way too much and eat up a lot of database resources
Jay
JayOP6mo ago
Is there a way for me to know whenever there is refreshed data? Does the live provide that? Then I could trigger a refetch
Chocci_Milk
Chocci_Milk6mo ago
You could always just have a useEffect to see if data changed but I don't recommend it. It would cause an infinite rerender loop

Did you find this page helpful?