From 3bbf63fdb415ddd5427f6c0b15182f94de97d02f Mon Sep 17 00:00:00 2001 From: panteliselef Date: Thu, 28 Sep 2023 12:48:13 +0300 Subject: [PATCH] chore(shared): Remove patch for swr-devtools --- .changeset/three-tigers-tell.md | 5 +++++ packages/shared/src/hooks/clerk-swr.ts | 7 ------- packages/shared/src/hooks/contexts.tsx | 2 -- packages/shared/src/hooks/useOrganization.tsx | 5 +---- packages/shared/src/hooks/usePagesOrInfinite.ts | 2 -- 5 files changed, 6 insertions(+), 15 deletions(-) create mode 100644 .changeset/three-tigers-tell.md diff --git a/.changeset/three-tigers-tell.md b/.changeset/three-tigers-tell.md new file mode 100644 index 00000000000..84750e15ab2 --- /dev/null +++ b/.changeset/three-tigers-tell.md @@ -0,0 +1,5 @@ +--- +'@clerk/shared': patch +--- + +Removes the patch for disabling swr-devtools causing apps with swr and broswers with the devtools extention to break. diff --git a/packages/shared/src/hooks/clerk-swr.ts b/packages/shared/src/hooks/clerk-swr.ts index cda5a3d7594..c54d7d48495 100644 --- a/packages/shared/src/hooks/clerk-swr.ts +++ b/packages/shared/src/hooks/clerk-swr.ts @@ -1,10 +1,3 @@ -export const disableSWRDevtools = () => { - if (typeof window !== 'undefined') { - // @ts-ignore - window.__SWR_DEVTOOLS_USE__ = undefined; - } -}; - export * from 'swr'; export { default as useSWR } from 'swr'; export { default as useSWRInfinite } from 'swr/infinite'; diff --git a/packages/shared/src/hooks/contexts.tsx b/packages/shared/src/hooks/contexts.tsx index 634b0bb4c04..8c18e278b08 100644 --- a/packages/shared/src/hooks/contexts.tsx +++ b/packages/shared/src/hooks/contexts.tsx @@ -11,8 +11,6 @@ import type { PropsWithChildren } from 'react'; import React from 'react'; import { deprecated } from '../utils'; -import { disableSWRDevtools } from './clerk-swr'; -disableSWRDevtools(); import { SWRConfig } from './clerk-swr'; import { createContextAndHook } from './createContextAndHook'; diff --git a/packages/shared/src/hooks/useOrganization.tsx b/packages/shared/src/hooks/useOrganization.tsx index d8354846813..3c27babf3c6 100644 --- a/packages/shared/src/hooks/useOrganization.tsx +++ b/packages/shared/src/hooks/useOrganization.tsx @@ -14,14 +14,11 @@ import type { import type { ClerkPaginatedResponse } from '@clerk/types'; import type { GetMembersParams } from '@clerk/types'; -import { disableSWRDevtools } from './clerk-swr'; - -disableSWRDevtools(); +import { deprecated } from '../utils'; import { useSWR } from './clerk-swr'; import { useClerkInstanceContext, useOrganizationContext, useSessionContext } from './contexts'; import type { PaginatedResources, PaginatedResourcesWithDefault } from './types'; import { usePagesOrInfinite, useWithSafeValues } from './usePagesOrInfinite'; -import { deprecated } from '../utils'; type UseOrganizationParams = { /** diff --git a/packages/shared/src/hooks/usePagesOrInfinite.ts b/packages/shared/src/hooks/usePagesOrInfinite.ts index 5324cf77ada..3f7d64c6d16 100644 --- a/packages/shared/src/hooks/usePagesOrInfinite.ts +++ b/packages/shared/src/hooks/usePagesOrInfinite.ts @@ -1,7 +1,5 @@ import { useCallback, useMemo, useRef, useState } from 'react'; -import { disableSWRDevtools } from './clerk-swr'; -disableSWRDevtools(); import { useSWR, useSWRInfinite } from './clerk-swr'; import type { ValueOrSetter } from './types'; import type { PaginatedResources } from './types';