-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2
Description
Context https://expensify.slack.com/archives/C03TQ48KC/p1741208342513379
Problem:
The backend doesn't know all the data the frontend needs, the frontend doesn't know if the we actually loaded from the backend all the data it is expecting/using. This leads to hard to debug/reproduce bugs when frontend tries to access a piece of data it thinks should exist but wasn't really loaded.
Solution:
Add a way so that we can indicate in the useOnyx calls if the data is ok to be missing or if we were expecting it to be there for sure:
- We will add a new param to useOnyx called canBeMissing
- We will add an ESLint rule so that all calls to useOnyx need to pass it (this is to allow us to add this param little by little instead of having to audit all useOnyx calls at once)
- When the param is false and the useOnyx call returns no data, we will log an alert in production (which will create issues for us to investigate). In dev we will instead throw, to try to catch the problem before it hits production, when you are working on dev (we need to double check this, if it is throwing everywhere then let's just log instead, as we don't want to break everything)
- Once all places that call useOnyx are passing the param, we will remove the ESLint rule and make the param in useOnyx mandatory
- To handle the case where data is being loaded from the DB/cache, the alert won't be logged in the case status is loading and when status changes to loaded then it would log if data is null and canBeMissing was true.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2
Type
Projects
Status
Done