diff --git a/client/js/models/post_list.js b/client/js/models/post_list.js index 74f089f3..57a7d841 100644 --- a/client/js/models/post_list.js +++ b/client/js/models/post_list.js @@ -17,6 +17,10 @@ class PostList extends AbstractList { } static search(text, offset, limit, fields) { + //For queries with random sorting, bypass cache by appending random number + let cache = text.includes('sort:random') + ? Math.round(Math.random() * 1000) + : 0; return api.get( uri.formatApiLink( 'posts', { @@ -24,6 +28,7 @@ class PostList extends AbstractList { offset: offset, limit: limit, fields: fields.join(','), + cache: cache, })) .then(response => { return Promise.resolve(Object.assign( diff --git a/client/js/views/posts_header_view.js b/client/js/views/posts_header_view.js index b0ddf5ce..2daf32d4 100644 --- a/client/js/views/posts_header_view.js +++ b/client/js/views/posts_header_view.js @@ -248,10 +248,9 @@ class PostsHeaderView extends events.EventTarget { this._navigate(); } _evtRandomButtonClick(e) { + e.preventDefault(); if (!this._queryInputNode.value.includes('sort:random')) { this._queryInputNode.value += ' sort:random'; - } else { - location.reload(); } this._navigate(); }