Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Array property item insert / remove not reflected in store via events

See original GitHub issue

Steps to reproduce

Patch a model that has an array property (e.g. someModel.nestedItems) Any removals / additions to the array property are not reflected in other clients even though real-time events arrive as they should.

A repo to reproduce:

  • npm install backend and frontend, run npm start and npm run serve.
  • Open localhost:8080, add an item (create called immediately)
  • Open a second browser window, click “disable cloning” in that second window, this will use item reference directly to render the form (instead of a clone) in order to see live changes
  • Try adding or removing items in the first window (and clicking save)

Expected behavior

Items are added/removed to/from item.nestedItems throughout all connected clients

Actual behavior

Items are not added/removed in the second client instance. Data is correct after a refresh.

No such issue with FeathersVuex version 1.1.4 (using store action instead of model instances, cause it’s not available in 1.1.4) Events are arriving via websockets without problems.

Module versions:

"@feathersjs/feathers": "^3.3.0",
"@feathersjs/socketio-client": "^1.2.0",
"feathers-vuex": "^1.6.2",
"": "^2.2.0",

NodeJS version: 10

Operating System: MacOS

Browser Version: Chrome 71

Module Loader: Webpack (Vue CLI default setup)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

marshallswaincommented, Jan 15, 2019

This is fixed in feathers-vuex@1.7.0-pre.44. npm i feathers-vuex@pre. You can see the implementation and test in the above-referenced commit. Thanks for pointing this out, everybody. Thanks for the issue @Palivonas 🍻

dkeblercommented, Jan 10, 2019

I can confirm that setting store.state.myservice.replaceItems = true in my store module eliminates the issue.

The question remains. Why does _merge walk enumerable properties of a model property value. It should walk the properties of the model but the values of those properties.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding or removing from an array based on if it includes ...
This works fine for adding the value to the array, however on removal there are unexpected outcomes. the item only is removed after...
Read more >
Data Structures: Objects and Arrays
It is a unary operator that, when applied to an object property, will remove the named property from the object. This is not...
Read more >
5. Working with Arrays and Loops - JavaScript Cookbook ...
This returned value determines if the array element is added to a new array: it is added if the function returns true; otherwise,...
Read more >
Array | Apple Developer Documentation
An array can store any kind of elements—from integers to strings to classes. Swift makes it easy to create arrays in your code...
Read more >
Custom Events
To use these properties to trigger a campaign, select your custom event or purchase, and add a Nested Property filter. Note that message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found