New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: miscellaneous updates to signin #211
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7c4a8c0
refactor(pages): update password reset expired token UI
joshuagraber d242640
refactor(pages): update login error handling
joshuagraber fb7c4c9
feat(components): Add error boundary
joshuagraber 7b1aa94
test(components): add test for error boundary
joshuagraber 52b5308
feat(pages): add catchall 404 route
joshuagraber a93d97a
test(components): update error boundary test
joshuagraber badac24
test: update name in error boundary test
joshuagraber c73dceb
test(components): update error boundary snapshots
joshuagraber bdfae19
refactor(components): update error boundary
joshuagraber 1be078e
test(app): update app snapshot
joshuagraber bb5dc2b
refactor(pages): add error boundary to results render
joshuagraber 361fffb
test(pages): update results snapshot
joshuagraber File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<component | ||
:is="component" | ||
v-if="error" | ||
class="pdap-flex-container-center h-[full]" | ||
> | ||
<h1>Oops, something went wrong!</h1> | ||
<p class="max-w-full" data-test="error-boundary-message"> | ||
If you keep seeing this message, please email | ||
<a href="mailto:contact@pdap.io">contact@pdap.io</a> for assistance. | ||
</p> | ||
</component> | ||
<slot v-else /> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
component: { | ||
type: String, | ||
default: 'div', | ||
}, | ||
}, | ||
data() { | ||
return { | ||
error: false, | ||
}; | ||
}, | ||
errorCaptured(error) { | ||
this.interceptError(error); | ||
}, | ||
methods: { | ||
interceptError(error) { | ||
this.error = error; | ||
}, | ||
}, | ||
}; | ||
</script> |
10 changes: 10 additions & 0 deletions
10
client/src/components/__tests__/__snapshots__/errorBoundary.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`ErrorBoundary > renders error content with error 1`] = ` | ||
<div class="pdap-flex-container-center h-[full]"> | ||
<h1>Oops, something went wrong!</h1> | ||
<p class="max-w-full"> If you keep seeing this message, please email <a href="mailto:contact@pdap.io">contact@pdap.io</a> for assistance. </p> | ||
</div> | ||
`; | ||
|
||
exports[`ErrorBoundary > renders slot content with no error 1`] = `<div></div>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import { beforeEach, describe, expect, it } from 'vitest'; | ||
import ErrorBoundary from '../ErrorBoundary.vue'; | ||
import { nextTick } from 'vue'; | ||
|
||
let wrapper; | ||
|
||
describe('ErrorBoundary', () => { | ||
beforeEach(() => { | ||
wrapper = mount(ErrorBoundary, { | ||
slots: { | ||
default: '<div data-test="default-slot" />', | ||
}, | ||
}); | ||
}); | ||
|
||
it('renders slot content with no error', () => { | ||
expect(wrapper.find('[data-test="default-slot"]').exists()).toBe(true); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders error content with error', async () => { | ||
wrapper.vm.interceptError(new Error('Generic error')); | ||
await nextTick(); | ||
|
||
expect(wrapper.find('[data-test="error-boundary-message"]').exists()).toBe( | ||
true, | ||
); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<main class="p-4"> | ||
<h1>Something went wrong on our end</h1> | ||
<p> | ||
If you keep seeing this message, please email | ||
<a href="mailto:contact@pdap.io">contact@pdap.io</a> for assistance. | ||
</p> | ||
</main> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'NotFound', | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note:
ErrorBoundary
can be added anywhere. For example, in thisv-for
, we can stop the error from bubbling all the way up the component tree and only render the error message in the single card that failed, so the user can still interact with the rest of the UI.