Skip to content

Commit

Permalink
fix(details): do not use empyt device ID
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Feb 15, 2024
1 parent 1dea83f commit 23244e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hooks/useDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export const useDetails = (): string | undefined => {
useEffect(() => {
const listener = (ev: HashChangeEvent) => {
try {
setDeviceId(new URL(ev.newURL).hash.slice(1))
const maybeDeviceId = new URL(ev.newURL).hash.slice(1)
if (maybeDeviceId.length > 0) {
setDeviceId(maybeDeviceId)
} else {
setDeviceId(undefined)
}
} catch (err) {
console.debug(`[useDetails]`, err)
}
Expand Down

0 comments on commit 23244e2

Please sign in to comment.