Skip to content

Commit

Permalink
Merge pull request #80 from danskernesdigitalebibliotek/DDFBRA-286-fi…
Browse files Browse the repository at this point in the history
…x-caching-and-state-on-search-result-page

fix: search machine to have a specific method for loading more results
  • Loading branch information
ThomasGross authored Dec 30, 2024
2 parents 20de6af + 28f8ffa commit 1ff8eb8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/machines/search/search.machine.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ export default setup({
},
}),
setSearchDataInContext: assign({
searchData: ({
event: {
output: { search },
},
}) => {
return {
hitcount: search.hitcount,
pages: [[...search.works]],
}
},
}),
addMoreDataInContext: assign({
searchData: ({
event: {
output: { search },
Expand Down
2 changes: 1 addition & 1 deletion lib/machines/search/search.machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default searchMachineSetup.createMachine({
}
},
onDone: {
actions: ["setSearchDataInContext"],
actions: ["addMoreDataInContext"],
target: "#search.idle",
},
onError: {},
Expand Down

0 comments on commit 1ff8eb8

Please sign in to comment.