This repository was archived by the owner on Apr 11, 2023. It is now read-only.
This repository was archived by the owner on Apr 11, 2023. It is now read-only.
Parsing the string of ids for a collection each time a model updates blocks the main process #143
Open
Description
I have a fairly big database with a table containing near 9K rows. When I fetch the collection the request takes about 8 seconds but the localsync methods takes a lot more and blocks the application.
After some debugging I found that the problem is that for each model it does the following:
- Reads the strings containing all the ids and parse it to an Array
- Pushes the id to the array
- Saves the array to a string and writes de corresponding model to localStorage
This is inefficient. I think the Collection should keep track of what models were stored in an array, and after all the models are stored it should write the string with all the models ids.
And the fetch method that triggers this behaviour should return a promise that resolves when all the models are stored.