Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor "updatedAt" checking logic #185

Open
TClark1011 opened this issue Nov 26, 2023 · 0 comments
Open

Refactor "updatedAt" checking logic #185

TClark1011 opened this issue Nov 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@TClark1011
Copy link
Owner

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.

@TClark1011 TClark1011 added the enhancement New feature or request label Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant