-
Notifications
You must be signed in to change notification settings - Fork 92
Fix error in trimTrailingSlash #2559
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -4,7 +4,7 @@ import { persistStore } from '$lib/stores/persist-store'; | |||
import type { DataEncoderStatus } from '$lib/types/global'; | |||
import { has } from '$lib/utilities/has'; | |||
|
|||
export const codecEndpoint = persistStore('endpoint', null, true); | |||
export const codecEndpoint = persistStore<string>('endpoint', null, true); |
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.
Wondering if we should consider enabling strictNullChecks
?
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.
We probably should just not use null
here, and use undefined
instead
export const codecEndpoint = persistStore<string | undefined>('endpoint', undefined, true);
That way when we access $codecEndpoint
it will be type safe. Although I see persistStore
is explicitly typed to accept null
as a default value, I'm not sure why that is.
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.
(this is probably fine for now though)
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.
Yeah left it null
for now as I didn't track down if there were any conditionals that relied on it being null
or something like that. I turned on strictNullChecks
just to see if we do this elsewhere and there were a bunch of places that popped up.
8000 | @@ -4,7 +4,7 @@ import { persistStore } from '$lib/stores/persist-store'; | ||
import type { DataEncoderStatus } from '$lib/types/global'; | |||
import { has } from '$lib/utilities/has'; | |||
|
|||
export const codecEndpoint = persistStore('endpoint', null, true); | |||
export const codecEndpoint = persistStore<string>('endpoint', null, true); |
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.
We probably should just not use null
here, and use undefined
instead
export const codecEndpoint = persistStore<string | undefined>('endpoint', undefined, true);
That way when we access $codecEndpoint
it will be type safe. Although I see persistStore
is explicitly typed to accept null
as a default value, I'm not sure why that is.
Description & motivation 💭
Seeing Sentry errors for
trimTrailingSlash
due to the argument beingnull
. This PR checks for potentiallynull
endpoint before callingtrimTrailingSlash
.Screenshots (if applicable) 📸
Design Considerations 🎨
Testing 🧪
How was this tested 👻
Steps for others to test: 🚶🏽♂️🚶🏽♀️
Checklists
Draft Checklist
Merge Checklist
Issue(s) closed
Docs
Any docs updates needed?