View not updating when Cordova 'resume' and 'backbutton' events trigger nav.pop()


#1

My issue is similar to this thread: Since the Beta 4, my views don't update, however, I am running 2.0.0-beta.19.

I have a cards variable in my view cards.js that renders a list of cards in my view:

this.cards = [];

When populated with data:

this.cards = [{'title': 'card 1'}, {'title': 'card 2'}, {'title': 'card 3'}]

When I update my variable on cordova resume:

let me = this; document.addEventListener('resume', function(){ me.resume(); }, false);

Resume function:

resume(){ console.log('func: resume'); let me = this; let resumeDate = new Date(); let resCkString = Utils.get_ddmmyyy(resumeDate); // if the resume time (day, month, year) is not the same as the start time then reload the data if( resCkString !== me.ckString ){ console.log('Resumed: app and data needs refreshing. res ck:', resCkString, 'app ck:',me.ckString); me.loadApiUrl(); // sets cards to a new array return from API me.nav.pop(); // force back to main cards page }else{ console.log('Resumed: No need to refresh data. res ck:', resCkString, 'app ck:',me.ckString); } }
The view does not update, but the console does log the new cards array value. It’s just not reflected in the view.

If I tap to change the page, the cards view updates quickly, and then goes to the new view. Is there a way to for the view to refresh? As I understand it this should happen automatically, it does when navigating ‘normally’.

I am also seeing the same issue - where you have to tap to update the view - when integrating a Hardware Back Button (Cordova ‘backbutton’ event) feature, which also manipulates the nav.

It seems anything to do with the:

nav.pop()

When using cordova based events is breaking the ability to update views (until the view is changed).

Any thoughts on this appreciated?


Since the Beta 4, my views don't update
#2

@joshmorony 's fixed this in his reply to this thread