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

Commits on Nov 30, 2021

  1. [BUGFIX release] Add model hook in route blueprint

    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 committed Nov 30, 2021
    Copy the full SHA
    e253e92 View commit details
    Browse the repository at this point in the history