Skip to content

Commit ad3c998

Browse files
committed
Fix issue with navigation getting stuck in a circular loop
1 parent 44b2d5a commit ad3c998

File tree

2 files changed

+1
-64
lines changed

2 files changed

+1
-64
lines changed

static/js/vue-cdr-access/src/components/displayWrapper.vue

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ Top level component for full record pages with searching/browsing, including Adm
7272
import notAvailable from "@/components/error_pages/notAvailable.vue";
7373
import notFound from '@/components/error_pages/notFound.vue';
7474
import get from 'axios';
75-
import isEmpty from 'lodash.isempty';
7675
import analyticsUtils from '../mixins/analyticsUtils';
7776
import errorUtils from '../mixins/errorUtils';
7877
import imageUtils from '../mixins/imageUtils';
@@ -189,9 +188,6 @@ Top level component for full record pages with searching/browsing, including Adm
189188
this.min_created_year = response.data.minSearchYear;
190189
this.filter_parameters = response.data.filterParameters;
191190
this.is_page_loading = false;
192-
if (!isEmpty(this.$route.query)) {
193-
this.updateUrl();
194-
}
195191
}).catch(error => {
196192
this.setErrorResponse(error);
197193
this.is_page_loading = false;
@@ -237,15 +233,6 @@ Top level component for full record pages with searching/browsing, including Adm
237233
}
238234
},
239235
240-
updateUrl() {
241-
let params = this.setTypes();
242-
this.$router.push({ name: 'displayRecords', query: params }).catch((e) => {
243-
if (this.nonDuplicateNavigationError(e)) {
244-
throw e;
245-
}
246-
});
247-
},
248-
249236
hasSearchQuery() {
250237
let query_params = this.$route.query;
251238
return Object.keys(query_params).some(key => query_params[key]

static/js/vue-cdr-access/tests/unit/displayWrapper.spec.js

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ describe('displayWrapper.vue', () => {
6868
await router.push(`/record/${response.container.id}`);
6969
mountApp();
7070
wrapper.vm.getBriefObject();
71-
wrapper.vm.updateUrl();
7271
wrapper.vm.retrieveSearchResults();
7372
await flushPromises();
7473

@@ -85,23 +84,19 @@ describe('displayWrapper.vue', () => {
8584
mountApp();
8685

8786
wrapper.vm.getBriefObject();
88-
wrapper.vm.updateUrl();
8987
wrapper.vm.retrieveSearchResults();
9088
await flushPromises();
9189
expect(wrapper.vm.search_method).toEqual('searchJson');
92-
expect(wrapper.vm.$router.currentRoute.value.query.types).toEqual('Work,File');
9390
});
9491

9592
it("uses the correct search parameters for non admin works only browse", async () => {
9693
await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/?works_only=false');
9794
mountApp();
9895

9996
wrapper.vm.getBriefObject();
100-
wrapper.vm.updateUrl();
10197
wrapper.vm.retrieveSearchResults();
10298
await flushPromises();
10399
expect(wrapper.vm.search_method).toEqual('listJson');
104-
expect(wrapper.vm.$router.currentRoute.value.query.types).toEqual('Work,Folder,Collection,File');
105100
});
106101

107102
it("uses the correct search parameters if search text is specified", async () => {
@@ -111,11 +106,9 @@ describe('displayWrapper.vue', () => {
111106
});
112107

113108
wrapper.vm.getBriefObject();
114-
wrapper.vm.updateUrl();
115109
wrapper.vm.retrieveSearchResults();
116110
await flushPromises();
117111
expect(wrapper.vm.search_method).toEqual('searchJson');
118-
expect(wrapper.vm.$router.currentRoute.value.query.types).toEqual('Work,Folder,Collection,File');
119112
});
120113

121114
it("uses the correct search parameters if facet parameter is specified", async () => {
@@ -125,11 +118,9 @@ describe('displayWrapper.vue', () => {
125118
});
126119

127120
wrapper.vm.getBriefObject();
128-
wrapper.vm.updateUrl();
129121
wrapper.vm.retrieveSearchResults();
130122
await flushPromises();
131123
expect(wrapper.vm.search_method).toEqual('searchJson');
132-
expect(wrapper.vm.$router.currentRoute.value.query.types).toEqual('Work,Folder,Collection,File');
133124
});
134125

135126
it("uses the correct parameters for admin unit browse", async () => {
@@ -159,55 +150,19 @@ describe('displayWrapper.vue', () => {
159150
});
160151

161152
wrapper.vm.getBriefObject();
162-
wrapper.vm.updateUrl();
163153
wrapper.vm.retrieveSearchResults();
164154
await flushPromises();
165155
expect(wrapper.vm.search_method).toEqual('listJson');
166-
expect(wrapper.vm.$router.currentRoute.value.query.types).toEqual('Work,Folder,Collection,File');
167156
expect(wrapper.find(".container-note").exists()).toBe(true);
168157
expect(wrapper.find('#browse-display-type').exists()).toBe(true);
169158
});
170159

171-
it("updates the url when work type changes", async () => {
172-
await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a?browse_type=gallery-display');
173-
mountApp({
174-
container_info: {
175-
briefObject: {
176-
type: 'Collection',
177-
objectPath: [
178-
{
179-
pid: 'collections',
180-
name: 'Content Collections Root',
181-
container: true
182-
},
183-
{
184-
pid: '353ee09f-a4ed-461e-a436-18a1bee77b01',
185-
name: 'testAdminUnit',
186-
container: true
187-
},
188-
{
189-
pid: 'fc77a9be-b49d-4f4e-b656-1644c9e964fc',
190-
name: 'testCollection',
191-
container: true
192-
}
193-
]
194-
},
195-
resourceType: 'Collection'
196-
}
197-
});
198-
199-
wrapper.vm.updateUrl();
200-
await flushPromises();
201-
expect(wrapper.vm.$router.currentRoute.value.query.types).toEqual('Work,Folder,Collection,File');
202-
});
203-
204160
it("displays a 'works only' option if the 'works only' box is checked and no records are works", async () => {
205161
stubQueryResponse(`searchJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+`, response);
206162
await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a?works_only=true');
207163
mountApp();
208164

209165
wrapper.vm.getBriefObject();
210-
wrapper.vm.updateUrl();
211166
wrapper.vm.retrieveSearchResults();
212167
await flushPromises();
213168
let works_only = wrapper.find('.container-note');
@@ -218,10 +173,7 @@ describe('displayWrapper.vue', () => {
218173
it("does not display a 'works only' option if the 'works only' box is not checked and no records are works", async () => {
219174
await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a?works_only=false');
220175
mountApp();
221-
// wrapper.vm.getBriefObject();
222-
// wrapper.vm.updateUrl();
223-
// wrapper.vm.retrieveSearchResults();
224-
// await flushPromises();
176+
225177
let works_only = wrapper.find('.container-note');
226178
expect(works_only.exists()).toBe(false)
227179
});
@@ -253,7 +205,6 @@ describe('displayWrapper.vue', () => {
253205
await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a');
254206
mountApp();
255207
wrapper.vm.getBriefObject();
256-
wrapper.vm.updateUrl();
257208
wrapper.vm.retrieveSearchResults();
258209
await flushPromises();
259210

@@ -357,7 +308,6 @@ describe('displayWrapper.vue', () => {
357308
let num_facets = wrapper.vm.$store.state.possibleFacetFields.length;
358309
expect(num_facets).toBeGreaterThan(0);
359310
expect(wrapper.vm.$store.state.possibleFacetFields.indexOf('unit')).toEqual(-1);
360-
expect(wrapper.vm.$route.query.facetSelect.indexOf('unit')).toEqual(-1);
361311

362312
// Trigger works only filter and make sure that the set of facets does not change
363313
await wrapper.find('#works-only').trigger('click');

0 commit comments

Comments
 (0)