Closed arosiclair closed 2 weeks ago
Triggered auto assignment to @laurenreidexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Job added to Upwork: https://www.upwork.com/jobs/~011415a3700cdef632
Triggered auto assignment to Contributor Plus for review of internal employee PR - @getusha (Internal
)
As mentioned, the root problem is that Onyx.connect
callbacks do not seem to run in our background process for Android (via headless js). Instead they run once the app is re-opened. That is blocking these two critical callbacks for filling update gaps in the background:
I started discussing this here.
One workaround is to optionally run the ONYX_UPDATES_FROM_SERVER
code synchronously. However, that still leaves ONYX_UPDATES_LAST_UPDATE_ID_APPLIED_TO_CLIENT
as an empty value. I'm not sure if there is a way to synchronously retrieve that value from Onyx atm.
Okay I've dug a bit further and found this part of the docs is crucial:
You can do anything in your task such as network requests, timers and so on, as long as it doesn't touch UI. Once your task completes (i.e. the promise is resolved), React Native will go into "paused" mode (unless there are other tasks running, or there is a foreground app).
Currently our PushNotification.onReceived
callback does not return any promise so the background task stops immediately after the function finishes. So to fix this issue, we need to return a promise that resolves after we get lastUpdateIDAppliedToClient
from Onyx and run GetMissingOnyxMessages
. I drafted these changes and it fixed the issue! I'll clean it up and post a PR soon.
PR is prepped and testing well however there are some conflicts that are gonna come in from #fireroom-2024-04-01-chats-do-not-load. Once those are in, I'll fix them and post the PR for review. ETA is end of next week.
Out for review!
Woohoo!
Can we close this?
Closing, reopen if you disagree.
@laurenreidexpensify could you please attach payment summary for C+ review - https://github.com/Expensify/App/pull/40022#issuecomment-2059285253
created a manual request here - https://staging.new.expensify.com/r/6707043287393435
Re-opening for payment summary so I can pay this one out.
Payment Summary:
C+ review @rushatgabhane $500 requested in newdot
$500 approved for @rushatgabhane
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: N/A Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): N/A Logs: N/A Expensify/Expensify Issue URL: Issue reported by: @arosiclair Slack conversation: N/A
Action Performed:
ONYX_UPDATES_FROM_SERVER
gets set in Onyx to fill the gapExpected Result:
The callback for
ONYX_UPDATES_FROM_SERVER
runs and calls theGetMissingOnyxMessages
API in the backgroundActual Result:
The callback does NOT run until the app is reopened
Workaround:
N/A
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit