vendredi 26 mai 2023

How can I troubleshoot a router.js:958 error while processing route: item in Ember.js?

Any thoughts as to how this can be fixed -- I have not a clue! It works fine until an upgrade is done. I have tried multiple times with various versions but no go.

post-upgrade: router.js:958 Error while processing route: item You must provide a param idPath. and
jquery.min.js:2 Uncaught Error: You must provide a param idPath.

bower.json original { "name": "shepherd", "private": true, "dependencies": { "bootstrap": "~3.3.2", "ember": "~1.10.0", "handlebars": "~3.0.0", "jquery": "~1.11.3" } } # updated(attempt) { "name": "shepherd", "private": true, "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests" ], "dependencies": { "jquery": "^3.7.0", "bootstrap": "^5.2.3", "handlebars": "^4.7.7", "ember": "^2.0" } }

# tab config  index.html: <script src="config.js"></script>
# consumed by app.js
<script src="app.js"></script>
var config = {}
config.title = 'TABS Title'
config.items = [
  {name: 'T1', items: [
    {name: "NDC-A", items: [
      {name: "T1-NDCA:Z1 Stats", url: "<LINK>"},
      {name: "T1-NDCA:Z1 Graphs", url: "<LINK>"},
      {name: "T1-NDCA:Z2 Stats", url: "<LINK>"},
      {name: "T1-NDCA:Z2 Graphs", url: "<LINK>"},
    ]},
    {name: "NDC-B", items: [
      {name: "T1-NDCB:Z1 Stats", url: "<LINK>"},
      {name: "T1-NDCB:Z1 Graphs", url: "<LINK>"},
      {name: "T1-NDCB:Z2 Stats", url: "<LINK>"},
      {name: "T1-NDCB:Z2 Graphs", url: "<LINK>"},
    ]},
   ]},
]

FYI: tabs sample as generated via above config # app.js index.html:

    var App = Ember.Application.create({
    })
    
    App.initializer({
        name: 'config',
        initialize: function(container, app) {
            app.config = Ember.copy(config)
        },
    })
    
    App.Router.map(function() {
        this.resource('item', {path: '/*idPath'})
    })
    
   // fails here
    
    App.ItemRoute = Ember.Route.extend(App.TitleHandler, App.ItemFactory, {
        model: function(params) {
            var items = this.getItems(App.config.items)
            var item = this.getItem(items, params.idPath)
            **// 'item' and 'items' are both populated as expected**
            if (!item) {
                return this.transitionTo('item', '')
            }
            this.setTitle(item.title)
            return item
            **// FAILS HERE 'port return'**
        },
    })
    
    



Aucun commentaire:

Enregistrer un commentaire