mharris717 / ember-cli-pagination

Pagination Addon for Ember CLI
MIT License
273 stars 116 forks source link

pagedArray computed helper doesn't pass the `contentProperty` attr to `computed` #281

Closed jeneve closed 4 years ago

jeneve commented 4 years ago

I am wondering why the pagedArray computed helper doesn't pass contentProperty to computed?

https://github.com/mharris717/ember-cli-pagination/blob/2fc16ea03c395a4fd694d9e432e47f7a28089c5f/addon/computed/paged-array.js#L6

I have a component:

import { alias } from '@ember/object/computed'
import Component from '@ember/component'
import hbs from 'htmlbars-inline-precompile'
import pagedArray from 'ember-cli-pagination/computed/paged-array'

export default Component.extend({
  tagName: '',

  content: null,
  layout: hbs`{{yield (assign pagedContent)}}`,
  page: 1,
  perPage: 30,

  pagedContent: pagedArray('content', {
    page: alias('parent.page'),
    perPage: alias('parent.perPage'),
  }),
})

Which when passed a changed content property does not yield back an updated pagedContent property.

The problem is fixed by either:

didRecieveAttrs() {
  this.notifyPropertyChange('pagedContent')
}

OR

layout: hbs`{{yield (assign pagedContent foo=content)}}`,

both of which lead me to think maybe the above referenced line is the culprit, but I may be missing some context?

broerse commented 4 years ago

Try it with Ember 3.12 It seems the problem started with Ember 3.13+

See: https://github.com/emberjs/ember.js/issues/18689

We are working on it and hope to fix it soon.

broerse commented 4 years ago

The fix is merged in Ember Canary See: https://github.com/emberjs/ember.js/pull/18703 So the options are running Ember 3.12 or Ember Canary