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

Non-blocking model hook breaks reachedInfinity #441

Open
jagthedrummer opened this issue Mar 8, 2021 · 0 comments
Open

Non-blocking model hook breaks reachedInfinity #441

jagthedrummer opened this issue Mar 8, 2021 · 0 comments

Comments

@jagthedrummer
Copy link

It seems that reachedInfinity isn't usable when a non-blocking model hook is used. The value is always undefined in the template.

This works as expected and shows the actual value of reachedInfinity:

// route
model(){
  return this.infinity.model('post');
}

// template
{{ @model.reachedInfinity }}

This does not work, and never shows any value for reachedInfinity:

// route
model(){
  return { posts: this.infinity.model('post') };
}

// template
{{ @model.posts.reachedInfinity }}

If I wrap the hash in RSVP.hash it does show the correct value for reachedInfinity but that prevents the model hook from being non-blocking:

// route
model(){
  return RSVP.hash({ posts: this.infinity.model('post') });
}

// template
{{ @model.posts.reachedInfinity }}

It seems like when the non-blocking model hook is used that the promise for the infinity model isn't resolved when trying to access reachedInfinity though it is resolved correctly when accessing the collection itself.

Am I missing something? Is there a good work around for using a non-blocking hook and being able to access reachedInfinity?

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