Skip to content

Commit

Permalink
fix(modal): fallback for non https context randomUUID
Browse files Browse the repository at this point in the history
  • Loading branch information
Quang Phan committed Sep 29, 2022
1 parent ae12a08 commit 0d37ceb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-pens-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@svelte-put/modal": patch
---

fallback in case `crypto.randomUUID` is not available (ex. non HTTPS context)
2 changes: 1 addition & 1 deletion packages/misc/modal/src/lib/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function createModalStore() {
};
});

let id: string = crypto.randomUUID();
let id: string = (crypto && crypto.randomUUID && crypto.randomUUID()) ?? `modal-indexed-${modals.length}`;
let props: ComponentProps<Component>;
let component: ComponentType<Component>;
if (typeof input === 'function') {
Expand Down

0 comments on commit 0d37ceb

Please sign in to comment.