Use nanoid instead of uuid

This commit is contained in:
Linus Flood
2024-12-05 10:57:45 +01:00
parent 66ee5e7cbc
commit bbadd3ac10
3 changed files with 44 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
import { nanoid } from "nanoid"
import { useMemo } from "react"
import { v4 as uuidv4 } from "uuid"
const storageKey = "sessionId"
@@ -12,7 +12,7 @@ export function useSessionId(): string | null {
let currentSessionId = sessionStorage.getItem(storageKey)
if (!currentSessionId) {
currentSessionId = uuidv4()
currentSessionId = nanoid()
sessionStorage.setItem(storageKey, currentSessionId)
}
return currentSessionId