emberjs / emberjs/ember.js

[Bug/Regression] 3.22.0-beta.1 triggers update assertion

Open
#19,110 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug
Since 3.22.0-beta.1 I've seen the update assertion triggered in non-production environments (so development serve/build & tests) when using ember-set-body-class.

I've traced it back to https://github.com/ef4/ember-set-body-class/blob/master/addon/services/body-class.js#L14 which is triggered when the set-body-class component is unrendered.

### 🔬 Minimal Reproduction
https://github.com/nickschot/body-class-reproduction

Press the toggle button twice and the assertion should show up in the console.

### 😕 Actual Behavior
The following assertion is shown:
```
index.js:172 Uncaught (in promise) Error: Assertion Failed: You attempted to update `[]` on `Array`, 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.

`[]` was first used:

- While rendering:
application
```

### 🤔 Expected Behavior
To not have the assertion shown. The set-body-class addon is quite old and has worked fine up until 3.21.

### 🌍 Environment

- Ember: 3.22.0-beta.1
- Node.js/npm: -
- OS: macOS Catalina
- Browser: Chrome

### ➕ Additional Context
Some related chatter in Discord: https://discordapp.com/channels/480462759797063690/485447409296736276/748256841573859389

An addon of mine which has the assertion in CI: https://travis-ci.org/github/nickschot/ember-mobile-menu/jobs/721443473#L439

I've also deployed a production build to github pages, but as I said before the assertion does not trigger in production so... : https://nickschot.github.io/body-class-reproduction/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.