amiel / ember-data-url-templates

an ember-addon to allow building urls with url templates instead of defining buildURL
https://github.com/amiel/ember-data-url-templates/wiki
MIT License
129 stars 22 forks source link

findRecord(id) uses queryRecordUrlTemplate, not findRecordUrlTemplate #45

Closed basz closed 6 years ago

basz commented 6 years ago

with these definitions;

  urlTemplate: '{+host}/commerce/stores/{storeId}/catalogues/{catalogueId}/product-groups{/id}{?query*}',
  queryUrlTemplate: '{+host}/commerce/stores/{storeId}/catalogues/{catalogueId}/product-groups{/id}{?query*}',
  queryRecordUrlTemplate:
    '{+host}/commerce/stores/{storeId}/catalogues/{catalogueId}/product-group{?query*}',
  findRecordUrlTemplate: '{+host}/commerce/stores/{storeId}/catalogues/{catalogueId}/product-groups{/id}{?query*}',

If I do

 .findRecord('commerce/product-group', productGroupId, {
        reload: true,
        include: 'parent.parent.parent.parent'
      })

The queryRecordUrlTemplate is used.

When I comment queryRecordUrlTemplate out findRecordUrlTemplate is used.

Am I doing this wrong? What logic is behind this?

basz commented 6 years ago

Could it be that queryTypes are changed from findRecord to queryRecord when there is a query object present? There is because of ember-data-slug that I'm using.

https://github.com/pangratz/ember-data-slug/blob/master/addon/mixins/adapter-slug-support.js

basz commented 6 years ago

Yes, confirmed, uninstalling data-slug resolved this issue. Now I need me slugs back somehow :-) thanks!

amiel commented 6 years ago

Good sleuthing @basz!

basz commented 6 years ago

Thanks, whats sleuthing? ;)

Op 24 apr. 2018 om 17:28 heeft Amiel Martin notifications@github.com het volgende geschreven:

Good sleuthing @basz!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

amiel commented 6 years ago

It’s like detective-work. On Tue, Apr 24, 2018 at 8:34 AM Bas Kamer notifications@github.com wrote:

Thanks, whats sleuthing? ;)

Op 24 apr. 2018 om 17:28 heeft Amiel Martin notifications@github.com het volgende geschreven:

Good sleuthing @basz!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/amiel/ember-data-url-templates/issues/45#issuecomment-383977494, or mute the thread https://github.com/notifications/unsubscribe-auth/AABqGEctjQixFAueu7XOL1m3zHl1QOt6ks5tr0YVgaJpZM4Th0Mo .