8000 Merge/Replace inject does not reevaluate computed properties · Issue #316 · js-data/js-data · GitHub
[go: up one dir, main page]

Skip to content
Merge/Replace inject does not reevaluate computed properties #316
Closed
@kenjiqq

Description

@kenjiqq

Hi.
Have discovered something i would consider a bug with the inject code.
The first time an item is injected into the store the result you get back from DS.inject() will have all computed properties evaluated and ready when the function returns.
But if an item exists in the store already with the same ID, then computed properties on the value returned from DS.inject() have not been reevaluated yet. This means for the different OnConflict strategies:
Merge: The item will have the old computed properties and not be updated yet.
Replace: The item will have no computed properties because they where deleted and are not evaluated again yet.

My guess is that this happens because the computed properties are triggered manually the first time the item is injected, but on the second there is some async change handler that causes them to be reevaluated so it happens after the function returns.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0