Bug fixes and buttons for previous and next page

* Use buttons for next and previous page in search results
* Add custom routine for stringifying and parsing the selector to JSON
so RegExp objects are preserved
This commit is contained in:
John R. Supplee 2021-01-27 16:15:54 +02:00
parent 4e8fc46475
commit 78a1d08a17
6 changed files with 74 additions and 15 deletions

View file

@ -116,7 +116,7 @@ BlazeComponent.extendComponent({
if (this.queryParams) {
const sessionData = this.getSessionData();
// eslint-disable-next-line no-console
console.log('selector:', JSON.parse(sessionData.selector));
console.log('selector:', sessionData.getSelector());
// console.log('session data:', sessionData);
const cards = Cards.find({ _id: { $in: sessionData.cards } });
this.queryErrors = sessionData.errors;
@ -414,7 +414,7 @@ BlazeComponent.extendComponent({
const params = {
limit: this.resultsPerPage,
selector: JSON.parse(sessionData.selector),
selector: sessionData.getSelector(),
skip: sessionData.lastHit,
};
@ -441,7 +441,7 @@ BlazeComponent.extendComponent({
const params = {
limit: this.resultsPerPage,
selector: JSON.parse(sessionData.selector),
selector: sessionData.getSelector(),
skip:
sessionData.lastHit - sessionData.resultsCount - this.resultsPerPage,
};