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

debt: refactor mobile app selectors to better handle situations where data is deleted from store while user is viewing the data #2854

Open
shrouxm opened this issue Jan 30, 2025 · 0 comments

Comments

@shrouxm
Copy link
Member

shrouxm commented Jan 30, 2025

currently, our app generally assumes in the type system that if you have an ID pointing to an entity (e.g. site or project) that that entity will exist in the redux store. this assumption worked on the web when the state of the store was very transient, but in a persistent & offline capable mobile app it no longer makes sense.

as it stands, developers need to just remember to do the right thing everywhere and not assume that entities are valid without checking, which is very contrary to how most things work in the codebase where the TypeScript types can be pretty reliable. this makes it really easy to mess it up.

i think the right approach to this is to first create tests that validate the desired behavior, and then consider also refactoring the code to have more honest TypeScript types. this could be a fairly large effort, so i expect that this issue would be a parent issues tracking several more manageable chunks of work.

i picked a medium priority to reflect the fact that developing new screens or modifying existing ones could be quite error prone for surprising conditions until we address this properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant