Skip to content

Commit

Permalink
Use Symbol() instead of empty object for context keys
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Nov 23, 2023
1 parent 81b1f33 commit 02788d2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-spiders-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-ux': patch
---

Use Symbol() instead of empty object for context keys
2 changes: 1 addition & 1 deletion packages/svelte-ux/src/lib/components/ToggleGroup.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script context="module">
export const groupKey = {};
export const groupKey = Symbol();
</script>

<script lang="ts">
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-ux/src/lib/stores/fetchStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type FetchConfig<TData = any> = {
suppressErrors?: boolean;
};

const CONTEXT_KEY = {};
const CONTEXT_KEY = Symbol();

export function initFetchClient(config: FetchConfig<any>) {
setContext(CONTEXT_KEY, config);
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-ux/src/lib/stores/graphStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type GraphQLError = {
extensions?: any;
};

const CONTEXT_KEY = {};
const CONTEXT_KEY = Symbol();

export function initGraphClient(config: ClientConfig) {
setContext(CONTEXT_KEY, config);
Expand Down

1 comment on commit 02788d2

@vercel
Copy link

@vercel vercel bot commented on 02788d2 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.