mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/paging: remember results in history
This commit is contained in:
@ -37,6 +37,22 @@ class PageController {
|
||||
this._pageView.render(ctx);
|
||||
}
|
||||
|
||||
createHistoryCacheProxy(routerCtx, requestPage) {
|
||||
return page => {
|
||||
if (routerCtx.state.response) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(routerCtx.state.response);
|
||||
});
|
||||
}
|
||||
const promise = requestPage(page);
|
||||
promise.then(response => {
|
||||
routerCtx.state.response = response;
|
||||
routerCtx.save();
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
}
|
||||
|
||||
stop() {
|
||||
this._pageView.unrender();
|
||||
}
|
||||
|
Reference in New Issue
Block a user