ember-data-model-fragments icon indicating copy to clipboard operation
ember-data-model-fragments copied to clipboard

Auto tracking regression in +3.28

Open pjcarly opened this issue 2 years ago • 15 comments

I have narrowed down a regression in our application to Ember Data Model Fragments, we notice this since upgrading to 3.28 in certain scenarios.

I have tried debugging, but can't seem to figure out where the regression occurs. It happens in a context the moment we try to call model.get('address'). Where address is a fragment. We often see this as a warning, but in some specific scenario's it causes an outright error, crashing the application.

We are seeing this error:

index.js:129 Uncaught (in promise) Error: Assertion Failed: You attempted to update `_tracking` on `Tag`, but it had already been used previously in the same computation.  Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.

Seeing something similar here: https://github.com/emberjs/ember.js/issues/18613#issuecomment-1029901855 And thanks to the explanation of @NullVoxPopuli I kind of understand what is going on. Unfortunately, the solution presented await Promise.resolve(); does not fix the issue.

I will try to create a reproduction application, in the coming days.

pjcarly avatar Feb 14 '22 21:02 pjcarly

Thanks @pjcarly. When you say 3.28 do you mean ember-source or ember-data? But yeah a reproduction of some sort would be good 👍

patocallaghan avatar Feb 18 '22 04:02 patocallaghan

Both at 3.28, I have been trying to reproduce it the entire week, no luck so far. Still investigating.

pjcarly avatar Feb 18 '22 08:02 pjcarly

All right, I am a small step further, I managed to reproduce the error in a standalone application, it is the combination of this addon, together with ember-data-change-tracker.

And weirdly it does not occur with data mocked with ember-cli-mirage, but exact the same data returned with an endpoint, has the issue.

Still investigating...

pjcarly avatar Feb 18 '22 14:02 pjcarly

By using msw.js instead of ember-cli-mirage I was able to reproduce the issue in this repository:

https://github.com/pjcarly/autotracking-regression-repro

pjcarly avatar Feb 24 '22 13:02 pjcarly

Any updates on this ? We're hitting the same issue on our way to 4...

ptgamr avatar Aug 30 '22 03:08 ptgamr

Have you tried the betas?

knownasilya avatar Aug 30 '22 13:08 knownasilya

@knownasilya No I haven't, will try and let you know... Thank you!

ptgamr avatar Aug 30 '22 23:08 ptgamr

@ptgamr did you have luck?

knownasilya avatar Jan 16 '23 20:01 knownasilya

@knownasilya @ptgamr Any luck here? I'd love to get up to 4!

averydev avatar Apr 15 '23 01:04 averydev

There is a new release 6.0.1 that is supposed to support [email protected]+. Does it work for you @pjcarly ?

VincentMolinie avatar Jul 13 '23 13:07 VincentMolinie

I'll be releasing a new patch version today or tomorrow, so watch out for that as well.

knownasilya avatar Jul 13 '23 15:07 knownasilya

I'm on [email protected] and I had the same issue (before 6.0.0) but it's working now. I'm still checking but I think this is fixed

VincentMolinie avatar Oct 23 '23 16:10 VincentMolinie

@VincentMolinie any chance you can look into it?

knownasilya avatar Oct 24 '23 17:10 knownasilya

I am facing the same issue in our app. using

ember-data-model-fragment: 6.0.5 ember-data: 3.28.13 ember-source: 3.28.12

i do not have ember-data-change-tracker addon as my dependency though. Noticed that removing the defaultValue set for some attributes in the model seem to fix the issue, but unfortunately we need those defaults. any fix/workaround available?

sreeram-cv avatar Nov 07 '23 13:11 sreeram-cv

Most of my errors are gone. I saw it once last week if I tried to save a record that has fragment inside, I had to wait for the next run loop and then save my record and in that case it works correctly. But not sure it was linked to ember-data-model-fragments 🤷

VincentMolinie avatar Nov 20 '23 19:11 VincentMolinie