How to ensure that activating is ALWAYS called, or that activated object is disposed of

14 views
Skip to first unread message

David Parker

unread,
Sep 30, 2015, 7:50:08 AM9/30/15
to DurandalJS
Hi

I have an issue with back buttons, either on the browser itself, or using back buttons in custom navigation.

Normally A navigation will log:

Activating:object
Navigation Complete: object
Binding path : object

However on any back activity,   the console logs:

Navigation Complete:   object  (   the old, activated object )
binding path: object ( again, the old activated object )

What I need is to be able to always activate,  no matter how the page was reached.   

For example:    I have a list of data, this is fetched in activate: function(){   populate  items observableArray }

Now lets say,   this item is a list of weeks.

I.E   Week 1, Week 2, Week 3

But it will only fetch weeks from the API that have days.

Now when a user clicks on a week,   They are show the days for that week.    However
they have the ability to delete all the days,   this creates an empty week, that should then not be shown on the previous page.

However, when the back button is used,   the bad week is still there,  because the object is from an old activation.
Essentially if a user goes back, I am wanting to reload this data, as fresh.

This what I can only describe as caching of objects also seems to create a few problems on say iphone 5, because the memory is only 512
and the durandal stack just seems to pile objects onto it,   we cant seem to get rid of this cache either.

Any help advise would be much appreciated:

######## DURANDAL 2.1.0 #############

{  "name": "Durandal",
  "version": "2.1.0",
  "dependencies": {
    "jquery": "1.9.1",
    "requirejs": "2.1.11",
    "requirejs-text": "2.0.7",
    "knockout": "3.3.0"
  },
  "_release": "2.1.0",
  "_resolution": {
    "type": "version",
    "tag": "2.1.0",
    "commit": "613eb67114c9dacdc68604a34f91090cd33f8b0b"
  },
  "_target": "2.1.0",
  "_originalSource": "durandal"
}

####  KNOCKOUT 3.3.0 ##########

{
  "name": "knockout",
  "version": "3.3.0",
  "homepage": "http://knockoutjs.com/",
  "description": "Knockout makes it easier to create rich, responsive UIs with JavaScript",
  "main": "dist/knockout.js",
  "moduleType": [
    "amd",
    "globals",
    "node"
  ],
  "keywords": [
    "knockout",
    "mvvm",
    "mvc",
    "spa"
  ],
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "spec",
    "build/output"
  ],
  "_release": "3.3.0",
  "_resolution": {
    "type": "version",
    "tag": "v3.3.0",
    "commit": "26df265f41b51359e4746d78be51ab05ae2a75c6"
  },
  "_target": "3.3.0",
  "_originalSource": "knockout"
}
Reply all
Reply to author
Forward
0 new messages