Skip to content

Commit

Permalink
Add workaround for riotjs 2.3.1 routing issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpikl committed Nov 29, 2015
1 parent 1c12813 commit 44a84ae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/src/client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ var app = riot.observable({
localStorage.setItem('controlsVisible', this.controlsVisible ? 'true' : 'false');
},
route: function(view, param) {
app.viewParam = param;
app.trigger('route', view || 'emulator', param);
if (app.view !== view || app.viewParam !== param) { // Workaround for https://github.com/riot/route/issues/28
app.view = view;
app.viewParam = param;
app.trigger('route', view || 'emulator', param);
}
},
watch: function(events, tag, callback) {
callback = callback.bind(tag);
Expand All @@ -59,6 +62,10 @@ $(document).ready(function() {
riot.route.start(true); // start + exec
});

$(window).on('hashchange', function() {
riot.route.exec(); // Workaround for https://github.com/riot/route/issues/28
})

//=========================================================
// Utilities
//=========================================================
Expand Down

0 comments on commit 44a84ae

Please sign in to comment.