-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] Creating an optimistic action with a default avatar (SVG component) causes a failed write to Onyx storage #28885
Comments
Triggered auto assignment to @twisterdotcom ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.svg component not able store the onyx. What is the root cause of that problem?Line 73 in 1eae800
getDefaultAvatar will return the local reference as functions we can use as a component like <SVG/>
so we can't store the function in onyx store What changes do you think we should make in order to solve the problem?we need change Line 91 in 1eae800
Alternative solutionhere Option 2) we can change this to any one of themuse: ['@svgr/webpack', 'file-loader'] These three we can able to store in the onyx. we concat the above configuration because and if we change this configuration we do need some changes in the below components ( because some components directly render the SVG component
so like example we need to change the import statement. |
@marcaaron can I just slap |
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. |
Job added to Upwork: https://www.upwork.com/jobs/~01f221fc1261af7d28 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
My proposal import { SvgXml } from 'react-native-svg'; const svgXml = ''; import Onyx from 'react-native-onyx'; Onyx.set('svgImage', svgBase64); |
📣 @talent-dev610! 📣
|
This was the PR where we added file handling in Onyx - I haven't been following along with the changes that we've made since then but there's perhaps a chance that indexdb doesn't support storing SVGs or maybe we need to do something to the SVG to be able to store it as a blob |
I think I've seen this issue before when we tried to store default avatars in Onyx & from what i've seen, there's always errors when we try to store SVGs in Onyx - cc @grgia who also worked on avatars a lot in the past |
@pradeepmdk Thanks for the proposal. I don't think we can relay on the url as being offline you won't be able to access that url. |
@talent-dev610 Thanks for the proposal. Encoding will work but it will add more space and computation. Regardless your proposal is not complete as it's not clear when to encode / decode. Is this supposed to be done in |
@s77rt Proposal updated #28885 (comment) |
@pradeepmdk Thanks for the update. I think option 1 will do it but we will have a lot of code to update / test. Ideally we would want functions to be supported in Onyx store but we will have serialize / deserialize data internally. e.g.: // Insert phase
myFun = getDefaultAvatar(1);
if (typeof myFun === 'function') {
myFun = myFun.toString();
} // Retrieval phase
myFun = eval('(' + myFun + ')'); But eval is evil |
serialize / deserialize we are going to do in App/react-native-onyx ? |
@s77rt but we have an issue on offline in web(on native it will work fine). because offline on the web it will fail to load to this reference. |
If we are going with the serialize / deserialize path then it must be done within react-native-onyx. I'm not sure about the file loader as we currently use the imported svg files as components. |
Not overdue. Still looking for proposals |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@pradeepmdk I think just a string is enough if there is no benefit in using the Ast format. |
@s77rt so what is next progress here ? |
@pradeepmdk Can you please explain how you will achieve the serialize/deserialize functionality in |
Not overdue. Still looking for proposals |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@twisterdotcom, @s77rt Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Not overdue. Still looking for proposals |
My proposal import { SvgXml } from 'react-native-svg'; const svgXml = ''; import Onyx from 'react-native-onyx'; Onyx.set('svgImage', svgBase64); |
@talent-dev610 Please follow the proposal template and submit a more close to proof of concept solution for serialize/deserialize approach inside |
Not overdue still waiting on proposals. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Still waiting for proposals |
Same ^ |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Still looking for proposals |
Okay, I will allow @marcaaron to reopen if he thinks differently, but given we are moving towards a world where only real world reported bugs will be fixed, I'm going to close this. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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...
ReportUtils.js
.App/src/libs/ReportUtils.js
Lines 2660 to 2661 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 2641 to 2642 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 2602 to 2603 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 2485 to 2486 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 2411 to 2412 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 2337 to 2338 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 2298 to 2299 in 0d55bc9
App/src/libs/ReportUtils.js
Lines 1970 to 1971 in 0d55bc9
App/src/libs/actions/Task.js
Lines 626 to 627 in 0d55bc9
Expected Result:
Actual Result:
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?
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
The text was updated successfully, but these errors were encountered: