Skip to content

Non-blocking model hook breaks reachedInfinity #441

@jagthedrummer

Description

@jagthedrummer

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions