Does update return before its task is completed? #388
-
I have a really strange behaviour with a particular JsStore update command. This is my wrapper lib to save an svg image in an indexedDb table called WorkingImages.
This is the where I'm calling it.
I think it's clear what I'm doing here: I want to save the image markup with the wrapper and, when it finished, going to another page. What I have to do to accomplish this simple task is this bestiality:
With a 1 sec timeout everything works. Consider that the svg is really big (up to 8Mb). JsStore version 4.8.4 |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
I see, could you provide any reproducable example ? |
Beta Was this translation helpful? Give feedback.
-
Unfortunately not because the code is subject to copyright and it's really complex to rewrite. But if it could be useful I can add another important detail. IMHO it could be a sort of race condition and nobody has realized that before because, with a lot of computing power, everything works because the race is always won by JsStore. |
Beta Was this translation helpful? Give feedback.
-
It's a string extracted from the page markup.
The only difference is that in my case the svg markup can weigh up to 8Mb. |
Beta Was this translation helpful? Give feedback.
-
Well in my opinion the solution shouldn't be as complicated as you are designing. Since the update is an async operation you should always wait for a full promise completion. |
Beta Was this translation helpful? Give feedback.
-
@epikgit This issue has been fixed in v - 4.9.0 . Now update query by default wait for indexeddb tx completion which will make sure your data has been updated properly. You don't need to change anything in code, just update the version to 4.9.0. Let me know if you have any question, doubts or still seeing the same issue. |
Beta Was this translation helpful? Give feedback.
@epikgit This issue has been fixed in v - 4.9.0 . Now update query by default wait for indexeddb tx completion which will make sure your data has been updated properly.
You don't need to change anything in code, just update the version to 4.9.0.
Let me know if you have any question, doubts or still seeing the same issue.