App: [$500] Creating an optimistic action with a default avatar (SVG component) causes a failed write to Onyx storage

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

Coming from: https://github.com/Expensify/Expensify/issues/313434#issuecomment-1747916128 an investigation into why storing data to Onyx can fail…

  • I am not sure exactly. But there are several code flows where we might default to an SVG avatar in ReportUtils.js.

https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2660-L2661 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2641-L2642 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2602-L2603 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2485-L2486 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2411-L2412 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2337-L2338 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L2298-L2299 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/ReportUtils.js#L1970-L1971 https://github.com/Expensify/App/blob/0d55bc9ced437a38f521e01322019c719651ec0b/src/libs/actions/Task.js#L626-L627

  • IndexedDB cannot save this to storage and throws an error.
  • This error is confirmed throwing in the logs.

Expected Result:

  1. The optimistic report action is saved correctly

Actual Result:

  1. The user cannot persist the action in the device storage and an error is thrown

2023-10-04_15-47-42

Workaround:

Yes - it will largely not be felt by many people. However if they create the action while offline, then kill the app, then reopen then it could lead to some data loss or unexpected behavior

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: main Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL: Issue reported by: @marcaaron Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f221fc1261af7d28
  • Upwork Job ID: 1710091720770150400
  • Last Price Increase: 2023-12-12

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 73 (53 by maintainers)

Most upvoted comments

@s77rt for current update now i am convert the svg component into Ast format and stored in the onyx. Screenshot 2023-11-18 at 3 51 57 AM now i am working on the again convert into svg component on run time. using this https://babeljs.io/docs/babel-core#transformfromastsync i will update you here once this done.

sorry for the delay my system is broken I ordered a new system so waiting for that. I will update you on the coming 16

yes, @twisterdotcom I working on the solution I will update the working solution this weekend.

yes. But I’m curious to understand whether we ever supported saving SVG to IndexedDB.

Maybe @thienlnam or @Beamanator remember the answer to this one. I think both of y’all have investigated some things related to Onyx and image storage IIRC.