-
-
Notifications
You must be signed in to change notification settings - Fork 344
target.splice is not a function #195
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
Comments
Hey, thanks for the clear explanation and boiled down repro. Really appreciate it 🙂 |
I think I can do you one better. I have been tinkering with the data a bit and found that the actual problem is not with the customers collection, but with a reference. Customers has an associative array (object) of project references, each indexed by its customer-specific number and having a reference to a project. A project, in turn, has an associative array (object) of items, each indexed by a project-specific number and having a reference to an item. Here is a breakdown of what this looks like (the collections currently only contain 1 item); /customers/1NajcTL22Dtr1mCxsgIf
/projects/83LUbEoK0LJUpv2LyW9u
/items/7TGYix43EJMccZ1iX1X7
Having the code as a key may seem superfluous, but in certain cases, multiple customers are linked to the same project with different customer-specific codes. Same for projects -> items. Where the error occurs is when querying the customer, it queries the projects and the items to generate some sort of path. The isFinite function is run on every key of the array or object. The key in projects/items is "567893" - which triggers "true" on isFinite, after which "items" is treated as an array, even though it is an object. Hope this helps! |
Fixed in the new version. Thanks for reporting it! |
In the firestore (@next) release, there is a function that deals with breaking down a path called walkSet. Inside this function, the path part is tested with isFinite and added to an array if true. If any other part of the path is !isFinite, the target is an object and not an array, resulting in "target.splice is not a function".
I think this is quite a rare case and highly dependent on the data in firestore, so I have created a Sandbox example using a demo account to connect to the specific data where I encountered this. It can be found here;
https://codesandbox.io/s/k9p895y6j5
main.js handles the setup and login with the demo account and App.vue is where the firestore binding causes this error.
The binding does work (or so it seems), as the data (1 customer) does appear in the document before it errors out.
The text was updated successfully, but these errors were encountered: