Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX release] Add model hook in route blueprint #19860

Merged
merged 1 commit into from Nov 30, 2021

Conversation

mixonic
Copy link
Sponsor Member

@mixonic mixonic commented Nov 30, 2021

When generating a route with a dynamic segment, say via:

ember g route foo --path="bar/:buzz_id"

The default empty route definition will cause an awkward assertion to be thrown.

  • In 3.28 without any data layer, the user is prompted via assertion to implement a model hook.
  • In 3.28 with Ember Data, an implicit fetch via Ember Data happens.
  • In 4.0 without any data layer, the user would be prompted via assertion to implement a model hook.
  • In 4.0 with Ember Data, the user would be prompted via assertion to either add a find method (old assertion) or to implement a model hook (new assertion via [BUGFIX release] Improve assert in default store #19858).

It is doubtless that many users will still encounter these behaviors, but updating the blueprints to generate a model hook by default improves on the happy path.

In theory this could go back to 3.28, however the value there is somewhat less since Ember Data's implicit store injection remains in that version (and therefore the assertions/messages are less confusing) and is common.

@mixonic mixonic marked this pull request as ready for review November 30, 2021 19:30
When generating a route with a dynamic segment, say via:

    ember g route foo --path="bar/:buzz_id"

The default empty route definition will cause an awkward assertion to be
thrown.

* In 3.28 without any data layer, the user is prompted via assertion to
  implement a model hook.
* In 3.28 with Ember Data, an implicit fetch via Ember Data happens.
* In 4.0 without any data layer, the user would be prompted via
  assertion to implement a model hook.
* In 4.0 with Ember Data, the user would be prompted via assertion to
  either add a `find` method (old assertion) or to implement a model
  hook (new assertion via
  emberjs#19858).

It is doubtless that many users will still encounter these behaviors,
but updating the blueprints to generate a model hook by default improves
on the happy path.

In theory this could do back to 3.28, however the value there is
somewhat less since Ember Data's implicit store injection remains in
that version (and therefore the assertions/messages are less confusing).
@mixonic mixonic merged commit 54f88da into emberjs:master Nov 30, 2021
@mixonic mixonic deleted the mixonic/update-blueprints branch November 30, 2021 19:49
@mixonic mixonic mentioned this pull request Dec 14, 2021
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants