Skip to content

Commit 44a84ae

Browse files
committed
Add workaround for riotjs 2.3.1 routing issue.
- riot/route#28
1 parent 1c12813 commit 44a84ae

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/src/client/app.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ var app = riot.observable({
3737
localStorage.setItem('controlsVisible', this.controlsVisible ? 'true' : 'false');
3838
},
3939
route: function(view, param) {
40-
app.viewParam = param;
41-
app.trigger('route', view || 'emulator', param);
40+
if (app.view !== view || app.viewParam !== param) { // Workaround for https://github.com/riot/route/issues/28
41+
app.view = view;
42+
app.viewParam = param;
43+
app.trigger('route', view || 'emulator', param);
44+
}
4245
},
4346
watch: function(events, tag, callback) {
4447
callback = callback.bind(tag);
@@ -59,6 +62,10 @@ $(document).ready(function() {
5962
riot.route.start(true); // start + exec
6063
});
6164

65+
$(window).on('hashchange', function() {
66+
riot.route.exec(); // Workaround for https://github.com/riot/route/issues/28
67+
})
68+
6269
//=========================================================
6370
// Utilities
6471
//=========================================================

0 commit comments

Comments
 (0)