diff --git a/web/src/stores/dandiset.ts b/web/src/stores/dandiset.ts index ed3e0598c..b44a314f6 100644 --- a/web/src/stores/dandiset.ts +++ b/web/src/stores/dandiset.ts @@ -52,7 +52,10 @@ export const useDandisetStore = defineStore('dandiset', { // this can be done concurrently, don't await this.fetchDandisetVersions({ identifier }); await this.fetchDandiset({ identifier, version }); - await this.fetchOwners(identifier); + + if (this.dandiset) { + await this.fetchOwners(identifier); + } }, async fetchDandisetVersions({ identifier }: Record) { let res; diff --git a/web/src/views/DandisetLandingView/DandisetLandingView.vue b/web/src/views/DandisetLandingView/DandisetLandingView.vue index c4f85eac2..622b9be17 100644 --- a/web/src/views/DandisetLandingView/DandisetLandingView.vue +++ b/web/src/views/DandisetLandingView/DandisetLandingView.vue @@ -10,6 +10,24 @@ /> +
+ + mdi-alert + Error: Dandiset does not exist + +

+ + Proceed to the Public Dandisets page + or use the search bar to find a valid Dandiset. + +
+
+ @@ -117,6 +135,10 @@ const store = useDandisetStore(); const currentDandiset = computed(() => store.dandiset); const loading = ref(false); + +// If loading is finished and currentDandiset is still null, the dandiset doesn't exist. +const dandisetDoesNotExist = computed(() => !loading.value && !currentDandiset.value); + const schema = computed(() => store.schema); const userCanModifyDandiset = computed(() => store.userCanModifyDandiset); diff --git a/web/test/src/tests/dandisetLandingPage.test.js b/web/test/src/tests/dandisetLandingPage.test.js index d9bdda587..0b2eecaf6 100644 --- a/web/test/src/tests/dandisetLandingPage.test.js +++ b/web/test/src/tests/dandisetLandingPage.test.js @@ -6,6 +6,7 @@ import { logout, waitForRequestsToFinish, clearCookiesAndCache, + CLIENT_URL, } from '../util'; describe('dandiset landing page', () => { @@ -60,4 +61,10 @@ describe('dandiset landing page', () => { await expect(page).toContainXPath(vChip(otherUserName)); await expect(page).toContainXPath(vChip(ownerName)); }); + + it('navigate to an invalid dandiset URL', async () => { + await page.goto(new URL('/dandiset/1', CLIENT_URL).href); + await waitForRequestsToFinish(); + await expect(page).toMatch('Error: Dandiset does not exist'); + }); });