Skip to content

Commit

Permalink
website: workaround bati localStorage empty bug
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Feb 19, 2025
1 parent b9c5848 commit 7716fc2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/pages/new/BatiWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function BatiWidget() {
setIsLoading(false)
return
}
localStorageEmptyBugWorkaround()
const script = document.createElement('script')
script.type = 'module'
script.src = scriptSrc
Expand Down Expand Up @@ -40,3 +41,10 @@ function wasAdded() {
const el = document.querySelector(`script[src="${scriptSrc}"]`)
return !!el
}

function localStorageEmptyBugWorkaround() {
const key = 'packageManager'
if (!localStorage[key]) {
localStorage[key] = 'npm'
}
}

0 comments on commit 7716fc2

Please sign in to comment.