ember-impagination icon indicating copy to clipboard operation
ember-impagination copied to clipboard

README does not explain how to trigger the first fetch

Open benshine opened this issue 9 years ago • 4 comments

From the README, it is unclear that we need to explicitly trigger the first fetch. The readme says "This setup will immediatly call fetch twice (for records 0-4 [page 0] and records 5-9 [page 1])"... but actually it won't.

I think the solution is to add

on-init=(action 'initializeReadOffset')

to the template, and an implementation of initializeReadOffset that just does this: dataset.setReadOffset(0);

Sound right? If so, I'll make a PR.

benshine avatar Apr 05 '17 05:04 benshine

100% agree, this is outdated documentation from the era before 1.0 and "only explicit actions can change the state"

cowboyd avatar Apr 05 '17 14:04 cowboyd

@benshine The README says the "setup will immediatly call fetch twice", but that is no longer the case since the 1.0 era. The README should says the "setup will immediatly trigger the on-init action".

Once the readOffset is defined, it will trigger the fetch action

Thanks for pointing this out. A PR would be much appreciated.

flexyford avatar Apr 05 '17 15:04 flexyford

I was thinking we should at least get a branch going that guys everything that is wrong in the readme.

Robdel12 avatar Apr 05 '17 15:04 Robdel12

I don't know the library well enough to fix everything wrong in the readme, but I can at least fix this particular bit!

benshine avatar Apr 05 '17 16:04 benshine