ember-cli-pagination icon indicating copy to clipboard operation
ember-cli-pagination copied to clipboard

Instances of `page-numbers` trigger errors with certain attribute orders

Open jasonmevans opened this issue 6 years ago • 1 comments

I discovered this issue just now while implementing pagination in my project. The underlying stack trace and error messaging surrounding the issue were not clear, so I did a bit of digging into the ember source code. It seems that the way this project requires properties to be passed into the page-numbers component causes an exception when content does not come first.

https://github.com/mharris717/ember-cli-pagination/blob/9f43e32c14f024fac6d7aab45f51f651cc61e5b4/addon/components/page-numbers.js#L9

The reason being that on this line the currentPage property is a bound alias to content.page. Now, if currentPage comes before content you will receive a console error saying, "Property set failed: object in path "content" could not be found or was destroyed."

{{page-numbers currentPage=page content=results }}

screen shot 2018-03-13 at 4 51 58 pm

If the order is changed to this then the error will be resolved:

{{page-numbers content=results currentPage=page }}

jasonmevans avatar Mar 14 '18 00:03 jasonmevans

I'm experiencing the same, and similar issues the other way around.

Is there a similar ember-cli module that works with property names as used in the JSON:API documentation for pagination? I'm having to do a lot of guesswork for undocumented things (such as nested properties), so I would rather try something that works with zero configuration.

Redsandro avatar Oct 15 '19 11:10 Redsandro