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
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.
The text was updated successfully, but these errors were encountered:
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)
Thinking about this, I am not sure it will work since IIRC the ESLint rules in App run for all files and not only modified files?
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:
The text was updated successfully, but these errors were encountered: