Skip to content

Commit 09c2c4a

Browse files
atrakhConvex, Inc.
authored and
Convex, Inc.
committed
dashboard: fix issue with theme not being detected (#33645)
We had two versions of `next-themes` and they are not compatible with eachother. For now, re-export next-themes from dashboard-common GitOrigin-RevId: 2a345af89f770ecec2ffae3fa0b9c34d0ab66fc9
1 parent c2531a8 commit 09c2c4a

File tree

9 files changed

+15
-20
lines changed

9 files changed

+15
-20
lines changed

Diff for: npm-packages/common/config/rush/pnpm-lock.yaml

-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: npm-packages/dashboard-common/src/elements/ThemeConsumer.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useCallback, useEffect } from "react";
22
import { useTheme } from "next-themes";
33

4+
export { ThemeProvider, useTheme } from "next-themes";
5+
46
export function ThemeConsumer() {
57
const { setTheme, theme } = useTheme();
68

Diff for: npm-packages/dashboard/.storybook/themeDecorator.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ReactNode } from "react";
22
import { DecoratorHelpers } from "@storybook/addon-themes";
33
import type { DecoratorFunction, Renderer } from "@storybook/types";
4-
import { ThemeProvider } from "next-themes";
4+
import { ThemeProvider } from "dashboard-common";
55
import { ReactRenderer } from "@storybook/react";
66
const { initializeThemeState, pluckThemeFromContext, useThemeParameters } =
77
DecoratorHelpers;

Diff for: npm-packages/dashboard/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"launchdarkly-react-client-sdk": "^3.0.4",
4444
"lodash": "~4.17.21",
4545
"next": "14.2.21",
46-
"next-themes": "~0.2.1",
4746
"nprogress": "~0.2.0",
4847
"prop-types": "~15.8.1",
4948
"react": "^18.0.0",

Diff for: npm-packages/dashboard/src/components/header/UserMenu/UserMenu.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Menu, MenuLink, Tooltip } from "dashboard-common";
1+
import { Menu, MenuLink, Tooltip, useTheme } from "dashboard-common";
22
import {
33
GearIcon,
44
SunIcon,
@@ -12,7 +12,6 @@ import Image from "next/image";
1212
import { useCurrentTeam } from "api/teams";
1313
import { useCurrentProject } from "api/projects";
1414
import { useProfile } from "api/profile";
15-
import { useTheme } from "next-themes";
1615
import { cn } from "lib/cn";
1716
import startCase from "lodash/startCase";
1817
import { useRouter } from "next/router";

Diff for: npm-packages/dashboard/src/elements/ToastContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useTheme } from "next-themes";
1+
import { useTheme } from "dashboard-common";
22
import { Toaster } from "sonner";
33

44
export function ToastContainer() {

Diff for: npm-packages/dashboard/src/hooks/useStripe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import { useCreateSetupIntent } from "api/billing";
77
import { useState, useEffect, useCallback } from "react";
88
import { Team } from "generatedApi";
9-
import { useTheme } from "next-themes";
9+
import { useTheme } from "dashboard-common";
1010

1111
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY!);
1212

Diff for: npm-packages/dashboard/src/pages/_app.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// eslint-disable-next-line import/no-relative-packages
22
import "../../../dashboard-common/src/styles/globals.css";
33
import type { AppProps } from "next/app";
4-
import { ThemeProvider } from "next-themes";
54
import { useAuth0 } from "hooks/useAuth0";
65
import { useRouter } from "next/router";
76
import React, { useEffect } from "react";
@@ -30,7 +29,12 @@ import { RefreshSession } from "components/login/RefreshSession";
3029
import { useDashboardVersion } from "hooks/api";
3130
import { useProfile } from "api/profile";
3231
import { useGlobalLDContext, useLDContext } from "hooks/useLaunchDarklyContext";
33-
import { Favicon, LoadingLogo, ThemeConsumer } from "dashboard-common";
32+
import {
33+
Favicon,
34+
LoadingLogo,
35+
ThemeConsumer,
36+
ThemeProvider,
37+
} from "dashboard-common";
3438
import { CurrentDeploymentDashboardLayout } from "layouts/DeploymentDashboardLayout";
3539
import { Fallback } from "./500";
3640

Diff for: npm-packages/dashboard/src/pages/profile.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useAuth0 } from "hooks/useAuth0";
2-
import { useTheme } from "next-themes";
3-
4-
import { RadioGroup } from "@headlessui/react";
52
import {
3+
useTheme,
64
Sheet,
75
LoadingTransition,
86
Button,
@@ -11,6 +9,8 @@ import {
119
TextInput,
1210
ConfirmationDialog,
1311
} from "dashboard-common";
12+
13+
import { RadioGroup } from "@headlessui/react";
1414
import classNames from "classnames";
1515
import { CheckCircledIcon } from "@radix-ui/react-icons";
1616
import { withAuthenticatedPage } from "lib/withAuthenticatedPage";

0 commit comments

Comments
 (0)