Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Temp fix for Glimmer 2 Backtracking re-render bug #438

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions addon/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ const {
A: emberArray,
Object: EmberObject,
get,
set
set,
run
} = Ember;

export default EmberObject.extend({
unknownProperty(property) {
set(this, property, emberArray());
return get(this, property);
run.once(() => { set(this, property, emberArray()); });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels wrong. Adding a runloop entry shouldn't be necessary

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I'm unsure how to resolve this. At least as a temp solution moving the set into the runloop allows to avoid getting the hard error You modified errors.model twice in a single render from #438 and is also the often-mentioned solution from the original discussion of the Glimmer 2 issue.

Interestingly, the error is only thrown on validation of existing records.

If needed, I can try to reproduce this in a Twiddle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sevab We try with #445,What do you think?

return emberArray();
}
});