# HG changeset patch # User Ludovic Chabant # Date 1360201143 28800 # Node ID a73a3c0b6d4aef940d7711bcc2259a0a76f7e89b # Parent 130eccd396d88ca8e74d329af696621ac4871dca Fixed some bugs with the page state warning. TODO: still another bug to fix where the state info comes in between the path update and the content update. diff -r 130eccd396d8 -r a73a3c0b6d4a static/js/wikked/views.js --- a/static/js/wikked/views.js Wed Feb 06 08:22:31 2013 -0800 +++ b/static/js/wikked/views.js Wed Feb 06 17:39:03 2013 -0800 @@ -226,13 +226,7 @@ e.preventDefault(); return false; }, - _onModelChange: function() { - PageReadView.__super__._onModelChange.apply(this, arguments); - - // Fetch the state if the current page changed. - if (!this.model.hasChanged('path')) - return; - + _checkPageState: function() { var stateTpl = this.warningTemplate; var stateModel = new Models.PageStateModel({ path: this.model.get('path') }); stateModel.fetch({ @@ -249,6 +243,16 @@ } } }); + }, + _firstRender: true, + _onModelChange: function() { + PageReadView.__super__._onModelChange.apply(this, arguments); + + // Fetch the state if the current page changed. + if (this.model.hasChanged('path') || this._firstRender) { + this._checkPageState(); + this._firstRender = false; + } } });