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

lastSuccessful updates even though it hasn't actually changed yet #467

Open
Techn1x opened this issue Jun 10, 2022 · 1 comment
Open

lastSuccessful updates even though it hasn't actually changed yet #467

Techn1x opened this issue Jun 10, 2022 · 1 comment

Comments

@Techn1x
Copy link

Techn1x commented Jun 10, 2022

I'm on Ember 3.28 so everything is autotracked. I noticed that when you perform() a task, it updates lastSuccessful twice. Or at least something is causing it to update.

get lastSuccessful() {
  return this.taskDef.lastSuccessful
}

With a getter like this, it seems as though it is being called recalculated immediately when the perform() is called, and then again after that new task is successful. In theory, the lastSuccessful property should never change as soon as perform() is called - it should only ever need to change & cause tracking updates when a perform() has finished and been successful

My use case is that I have a table like this, and each time the perform is called to go get a new value, the rows get rendered twice

{{#each this.taskDef.lastSuccessful.value as |row|}}
  <tr>
    // each time taskDef is performed, I get rendered twice :(
  </tr>
{{/each}}

I think this is a bug, but let me know if I'm doing things wrong.

@Techn1x
Copy link
Author

Techn1x commented Jun 10, 2022

I also tried using the @lastValue('taskDef') decorator hoping it did some caching magic, but no luck there.

I should mention, it's not just lastSuccessful - other properties like lastComplete exhibit similar behaviour, so I suspect it's something deeper.

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

1 participant