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

[Bug] Since 3.22 {{did-update does not trigger when value changed on insert #19403

Closed
st-h opened this issue Feb 12, 2021 · 3 comments
Closed

Comments

@st-h
Copy link
Contributor

st-h commented Feb 12, 2021

🐞 Describe the Bug

With ember <= 3.21, the {{did-update modifier would fire, when a value would be changed on {{did-insert. Starting with ember 3.22 this no longer seems to be the case (tested up to 3.25)

🔬 Minimal Reproduction

A simple component to reproduce this issue:

<div {{did-insert this.onInsert}}
     {{did-update this.onChange this.testValue}}>
     If you do not see an alert, this test failed....
</div>
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export default class TestBoxComponent extends Component {

  @tracked testValue = false;

  @action
  onInsert() {
    this.testValue = true;
  }

  @action
  onChange() {
    alert('test successful');
  }
}

Repro:
https://github.com/st-h/ember-did-update
Change ember-source in package.json to 3.22.0 in order to make it fail.

😕 Actual Behavior

{{did-update does no longer fire when the value is changed from within {{did-insert.

🤔 Expected Behaviour

{{did-update triggers whenever the value changes.

🌍 Environment

  • Ember: >= 3.22
  • Node.js/npm: v15.4.0/7.0.15
  • OS: MacOS 10.15.7
  • Browser: -

➕ Additional Context

Add any other context about the problem here.

@st-h
Copy link
Contributor Author

st-h commented Feb 12, 2021

Had some help in discord and we figured that it would be better to move what I had in did-insert into the constructor of the component. It was somewhat considered expected behaviour when a value that is updated in did-insert did not fire did-update. I'll leave this issue open, so it can be decided if the change from ember 3.21 to 3.22 is considered a regression.

@patricklx
Copy link
Contributor

might be same issue as emberjs/ember-render-modifiers#20

@st-h
Copy link
Contributor Author

st-h commented Jun 13, 2022

I'll close this issue as there is no point in deciding if a change that happened more than a year ago would be considered a regression.

@st-h st-h closed this as completed Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants