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
Right now, we use some middleware functionality on the "sheetRelatedProcedure" trpc object to make sure that whenever an element with a "sheetId" element is returned from a trpc mutation, we then go and update that sheet's updatedAt attribute. This makes sure that whenever we update any entity related to a sheet, it will also update parent sheet's updatedAt date. This is used, because on the client whenever we do an optimistic update, we increment the sheet's updatedAt, then when sheet data is fetched from the server, if that sheet data has an earlier updatedAt than we have in our client state, we know that server data is out of data and should not be saved into our client state.
We should refactor this to remove the use of the middleware, and instead give every sheet related entity an updatedAt field, and then to compare two sheet entities with all their related entities, we map through the sheet's own updatedAt attribute, as well as the updatedAt field's of all of the sheet's characters, items, and currencies, and then we find the most recent updatedAt, and use that.
The text was updated successfully, but these errors were encountered:
Right now, we use some middleware functionality on the "sheetRelatedProcedure" trpc object to make sure that whenever an element with a "sheetId" element is returned from a trpc mutation, we then go and update that sheet's
updatedAt
attribute. This makes sure that whenever we update any entity related to a sheet, it will also update parent sheet'supdatedAt
date. This is used, because on the client whenever we do an optimistic update, we increment the sheet'supdatedAt
, then when sheet data is fetched from the server, if that sheet data has an earlierupdatedAt
than we have in our client state, we know that server data is out of data and should not be saved into our client state.We should refactor this to remove the use of the middleware, and instead give every sheet related entity an
updatedAt
field, and then to compare two sheet entities with all their related entities, we map through the sheet's ownupdatedAt
attribute, as well as theupdatedAt
field's of all of the sheet's characters, items, and currencies, and then we find the most recentupdatedAt
, and use that.The text was updated successfully, but these errors were encountered: