Skip to content

Commit 0e58faf

Browse files
authored
Frontend/Fix license list edge cases (#606)
### Requirements List - _None_ ### Description List - Fixed page-advance breaking after detail view - Better handle edge case of cache getting cleared on detail view ### Testing List - `yarn test:unit:all` should run without errors or warnings - `yarn serve` should run without errors or warnings - `yarn build` should run without errors or warnings - Code review - License search - As Staff user, perform a license search that will result in multiple pages of licensees - Click on a result row to be navigated to the licensee detail page - Return to the list page - Attempt to advance to next pages - Regression: Make sure full license search / results / view flow still works stably Closes #604
1 parent 711562b commit 0e58faf

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

webroot/src/components/Licensee/LicenseeList/LicenseeList.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,22 @@ class LicenseeList extends Vue {
4646
// Lifecycle
4747
//
4848
async created() {
49-
if (this.licenseStore.model?.length) {
49+
if (this.licenseStoreRecordCount) {
5050
this.hasSearched = true;
5151
}
5252
}
5353

5454
async mounted() {
55-
if (!this.licenseStore.model?.length) {
55+
if (!this.licenseStoreRecordCount) {
56+
// License store is empty - apply defaults
5657
await this.setDefaultSort();
5758
await this.setDefaultPaging();
59+
} else if (this.licenseStoreRecordCount === 1 && !this.searchDisplayAll) {
60+
// Edge case: Returning from a detail page that was refreshed / cache-cleared
61+
this.shouldShowSearchModal = true;
62+
} else {
63+
// License store already has records
64+
this.isInitialFetchCompleted = true;
5865
}
5966
}
6067

@@ -77,6 +84,10 @@ class LicenseeList extends Vue {
7784
return this.$store.state.license;
7885
}
7986

87+
get licenseStoreRecordCount(): number {
88+
return this.licenseStore.model?.length || 0;
89+
}
90+
8091
get searchParams(): LicenseSearch {
8192
return this.licenseStore.search;
8293
}

0 commit comments

Comments
 (0)