Skip to content

Possible issue with query params when using async setter #18765

Open
@Subaku

Description

@Subaku

I've got two params in a controller whose values are IDs to Ember Data model records. I have two select inputs where the selections are these model records. So in order to properly tie the params to the selections I use getters/setters for the two params.

My problem arises on page load and both params are set. Ember spins up and hits these getters/setters many times. One of the selections gets nulled out instead of selecting the correct model record. I've done some investigating it appears my problem originally came from having the optional feature "default-async-observers" set to false. The setters call Ember-Concurrency tasks in order to load the model records from my API so naturally there's some delay there. Now when I set the feature to true the problem in my app seems to go away though I still see a lot of hits to the getter/setters by Ember (first thing I'm wondering if normal). In a bare minimum app for testing this I sometimes still get the issue to crop up.

To help illustrate the problem here's a screen grab of my console on page load where the url was "/?paramOne=1&paramTwo=9". At the end you'll see the extra calls to paramTwo's setter/getter nulls it out and it doesn't get set.
image

I've got a small bare app that illustrates this problem if needed that I can publish. Just let me know.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions