Skip to content

chore(shared): Remove patch for swr-devtools #1794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-tigers-tell.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 0 additions & 7 deletions packages/shared/src/hooks/clerk-swr.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 0 additions & 2 deletions packages/shared/src/hooks/contexts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
5 changes: 1 addition & 4 deletions packages/shared/src/hooks/useOrganization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
/**
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/src/hooks/usePagesOrInfinite.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down