Skip to content

Commit

Permalink
fix: Search history fails to select corpus
Browse files Browse the repository at this point in the history
Fixes #405
  • Loading branch information
arildm committed Nov 13, 2024
1 parent f25f986 commit f3593d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Related words lookup must use OR [#401](https://github.com/spraakbanken/korp-frontend/issues/401)
- Add support for annotations of the type 'set' in attribute filters [#116](https://github.com/spraakbanken/korp-frontend/issues/116)
- Parallel mode is consistently checked against the `parallel` config setting, and not the mode name
- Search history fails to select corpus [#405](https://github.com/spraakbanken/korp-frontend/issues/405)

## [9.7.1] - 2024-09-18

Expand Down
19 changes: 11 additions & 8 deletions app/scripts/components/corpus-chooser/corpus-chooser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,20 @@ angular.module("korpApp").component("corpusChooser", {
$ctrl.firstCorpus = settings.corpora[selection[0]].title
}

if (!quiet) {
settings.corpusListing.select(selection)
$rootScope.$broadcast("corpuschooserchange", selection)
$location.search("corpus", selection.join(","))
}
settings.corpusListing.select(selection)
$location.search("corpus", selection.join(","))
}

// Sync when corpus selection is modified elsewhere.
$rootScope.$on("corpuschooserchange", (e, selected) => {
select(selected, true)
})
$rootScope.$watch(
() => $location.search().corpus,
(corpusIdsComma) => {
const corpusIds = corpusIdsComma ? corpusIdsComma.split(",") : []
const selectedIds = settings.corpusListing.mapSelectedCorpora((corpus) => corpus.id)
if (!_.isEqual(corpusIds, selectedIds)) $rootScope.$broadcast("corpuschooserchange", corpusIds)
}
)
$rootScope.$on("corpuschooserchange", (e, selected) => select(selected, true))

$ctrl.onShowInfo = (node: ChooserFolderSub | CorpusTransformed) => {
$ctrl.showInfoBox = node.id != $ctrl.infoNode?.id
Expand Down

0 comments on commit f3593d6

Please sign in to comment.