Skip to content
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

loop(max stack size exceeded) if creating an record, whose type was not loaded yet. and ember-inspector open #8006

Closed
patricklx opened this issue Jun 13, 2022 · 3 comments · Fixed by #8008 or adfinis/timed-frontend#792

Comments

@patricklx
Copy link
Contributor

createRecord will end up calling watchTypeIfUnseen ,
watchTypeIfUnseen is calling wrapModelType , which calls getRecords, which proceeds to do a sync, which then ends up calling watchTypeIfUnseen. See the stack strace in the description

Reproduction

need to have ember-inspector open

this.store.createRecord('my-record', my-data).save();

Description

-private.js:733 Uncaught RangeError: Maximum call stack size exceeded
at get type [as type] (-private.js:733:1)
at store._createRecordData (index.js:70:1)
at InternalModel.get (-private.js:6136:1)
at InternalModel._isRecordFullyDeleted (-private.js:5126:1)
at InternalModel.isHiddenFromRecordArrays (-private.js:5120:1)
at shouldIncludeInRecordArrays (-private.js:6936:1)
at RecordArrayManager._visibleIdentifiersByType (-private.js:7095:1)
at RecordArrayManager._syncLiveRecordArray (-private.js:7034:1)
at RecordArrayManager.liveRecordArrayFor (-private.js:7076:1)
at Store.peekAll (-private.js:9691:1)

  function @ file
  get type @ -private.js:733
  store._createRecordData @ index.js:70
  get @ -private.js:6136
  _isRecordFullyDeleted @ -private.js:5126
  isHiddenFromRecordArrays @ -private.js:5120
  shouldIncludeInRecordArrays @ -private.js:6936
  _visibleIdentifiersByType @ -private.js:7095
  _syncLiveRecordArray @ -private.js:7034
  liveRecordArrayFor @ -private.js:7076
  peekAll @ -private.js:9691
  getRecords @ index.js:187
  wrapModelType @ data_adapter.js:481
  watchTypeIfUnseen @ index.js:111
  store._createRecordData @ index.js:70
  get @ -private.js:6136
  _isRecordFullyDeleted @ -private.js:5126
  isHiddenFromRecordArrays @ -private.js:5120
  shouldIncludeInRecordArrays @ -private.js:6936
  _visibleIdentifiersByType @ -private.js:7095
  _syncLiveRecordArray @ -private.js:7034
  liveRecordArrayFor @ -private.js:7076
  peekAll @ -private.js:9691
  getRecords @ index.js:187
  wrapModelType @ data_adapter.js:481
  watchTypeIfUnseen @ index.js:111
  store._createRecordData @ index.js:70
  get @ -private.js:6136
  _isRecordFullyDeleted @ -private.js:5126
  isHiddenFromRecordArrays @ -private.js:5120
  shouldIncludeInRecordArrays @ -private.js:6936

Versions

"ember-data": "^4.4.0",
"ember-source": "^4.4.0",

@patricklx patricklx changed the title loop if creating an record, whose type was not loaded yet. and ember-inspector open loop(max stack size exceeded) if creating an record, whose type was not loaded yet. and ember-inspector open Jun 13, 2022
patricklx added a commit to patricklx/data that referenced this issue Jun 14, 2022
@spruce
Copy link
Contributor

spruce commented Jul 3, 2022

I just ran into this problem as well.

runspired pushed a commit that referenced this issue Jul 15, 2022
* schedule watchTypeIfUnseen to prevent loop

fixes #8006

* Update debug-adapter-test.js

* Update index.js

* Update index.js

* fix test

* Update debug-adapter-test.js

* keep Watching Model Types with store.push

* add comment

* fix test
@Techn1x
Copy link

Techn1x commented Sep 1, 2022

I don't want to admit how many hours I lost to this bug just now (running ember-data 3.28.10). The wave of relief when I closed ember inspector and everything started working again 😆

Glad to see it's fixed in 4.5 ❤️ can't wait till I get there.

@runspired
Copy link
Contributor

I'll backport this fix to 3.28

runspired pushed a commit that referenced this issue Sep 12, 2022
* schedule watchTypeIfUnseen to prevent loop

fixes #8006

* Update debug-adapter-test.js

* Update index.js

* Update index.js

* fix test

* Update debug-adapter-test.js

* keep Watching Model Types with store.push

* add comment

* fix test
runspired added a commit that referenced this issue Sep 12, 2022
* backport fix for #7786 from #7882

* schedule watchTypeIfUnseen to prevent loop (#8008)

* schedule watchTypeIfUnseen to prevent loop

fixes #8006

* Update debug-adapter-test.js

* Update index.js

* Update index.js

* fix test

* Update debug-adapter-test.js

* keep Watching Model Types with store.push

* add comment

* fix test

* [BUGFIX] serialize null array items to string (#8083)

* port fix from #7834 for #7824

Co-authored-by: patricklx <patricklx@users.noreply.github.com>
Co-authored-by: Cameron Dubas <camerondubas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants