slice-machine-ui 2.18.1-alpha.jp-unauthorized-error-improvement.8 → 2.18.1-alpha.jp-remove-shared-onboarding-experiment.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/7uIqfRATU8iBj2XIUVUvD/_buildManifest.js +1 -0
- package/out/_next/static/chunks/157-fa8b348c960c8283.js +3 -0
- package/out/_next/static/chunks/{248-a9c33f7fbe2da2f1.js → 248-bcd84e3d28d25f54.js} +1 -1
- package/out/_next/static/chunks/256-07f768a2b19b0a0e.js +4 -0
- package/out/_next/static/chunks/34-ca8515dda61c7c8a.js +1 -0
- package/out/_next/static/chunks/344-fdb3008f4bb3b0c1.js +1 -0
- package/out/_next/static/chunks/484-3e011e79c41f0342.js +1 -0
- package/out/_next/static/chunks/{489-a046ae0fa4f74435.js → 489-d85cd66ad0405bee.js} +1 -1
- package/out/_next/static/chunks/500-d3989390f5e8da53.js +1 -0
- package/out/_next/static/chunks/52d4c156-89c6ec6efca0a0bb.js +1 -0
- package/out/_next/static/chunks/630-7e1844076846ca4d.js +1 -0
- package/out/_next/static/chunks/{647-4379a741c8d85d9e.js → 647-aa094286bc248d52.js} +1 -1
- package/out/_next/static/chunks/{907-445266211c48b1a5.js → 907-180eb33eefccc237.js} +1 -1
- package/out/_next/static/chunks/a6495ab1.00190ac98e794d8f.js +28 -0
- package/out/_next/static/chunks/pages/{_app-6ee99840ce68524b.js → _app-d31f7ba82a417786.js} +212 -212
- package/out/_next/static/chunks/pages/{changelog-3901f2fc937d9648.js → changelog-fbed93d315cb5429.js} +1 -1
- package/out/_next/static/chunks/pages/changes-2d9f27b360c0f73d.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-816acb31b652239b.js → [customTypeId]-af9376721beb489e.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-dd04033db23a58f3.js → labs-34147f008c958a89.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-669d5479e81b638b.js → [pageTypeId]-a24665e91b882169.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-f237aaa755dc9a99.js → simulator-761a04bb54f8d60b.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-dac1c4223724ff24.js +1 -0
- package/out/_next/static/chunks/pages/slices-08fad24cf5a81c9c.js +1 -0
- package/out/_next/static/chunks/webpack-24ddb02bea621501.js +1 -0
- package/out/_next/static/css/{303dad78be1eb854.css → bc89f2cd4e4781f5.css} +1 -1
- package/out/_next/static/css/e8e03c0d4003d1eb.css +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +6 -6
- package/src/{features/errorBoundaries/DefaultErrorBoundary.tsx → ErrorBoundary.tsx} +2 -2
- package/src/features/auth/LogoutButton.tsx +36 -42
- package/src/features/builder/fields/contentRelationship/ContentRelationshipFieldPicker.tsx +3 -3
- package/src/features/changes/StatusBadge.tsx +9 -1
- package/src/features/customTypes/customTypesBuilder/PageSnippetDialog/PageSnippetDialog.tsx +3 -3
- package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +3 -3
- package/src/features/environments/actions/setEnvironment.ts +18 -0
- package/src/features/environments/useActiveEnvironment.ts +9 -17
- package/src/features/environments/useEnvironments.ts +8 -11
- package/src/features/labs/labsList/LabsPage.tsx +3 -3
- package/src/features/navigation/Navigation.tsx +8 -7
- package/src/features/navigation/RepositoryInfo.tsx +24 -18
- package/src/features/onboarding/OnboardingGuide.tsx +2 -5
- package/src/features/onboarding/useOnboarding.ts +1 -14
- package/src/features/slices/sliceBuilder/FloatingBackButton.tsx +3 -3
- package/src/features/sync/AutoSyncProvider.tsx +2 -2
- package/src/features/sync/getUnSyncChanges.ts +3 -1
- package/src/legacy/components/AppLayout/index.tsx +85 -10
- package/src/legacy/components/ChangesEmptyState/AuthErrorPage.tsx +44 -0
- package/src/legacy/components/ChangesEmptyState/index.ts +1 -1
- package/src/legacy/components/ChangesItems/ChangesItems.tsx +3 -3
- package/src/legacy/components/LoginModal/index.tsx +6 -14
- package/src/legacy/components/Navigation/ChangesItem.tsx +48 -96
- package/src/legacy/components/Navigation/Environment.tsx +7 -2
- package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx +8 -3
- package/src/legacy/components/Simulator/index.tsx +3 -3
- package/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx +3 -3
- package/src/modules/userContext/index.ts +5 -5
- package/src/modules/userContext/types.ts +3 -2
- package/src/pages/_app.tsx +95 -93
- package/src/pages/changes.tsx +5 -4
- package/test/__testutils__/index.tsx +10 -13
- package/out/_next/static/0C8VxwongjXZwHPchBnOi/_buildManifest.js +0 -1
- package/out/_next/static/chunks/04ad993f.d7f986af0f739cc9.js +0 -28
- package/out/_next/static/chunks/34-50c64778da33cff6.js +0 -1
- package/out/_next/static/chunks/349-7118116b93278f73.js +0 -4
- package/out/_next/static/chunks/429-1137c819c2bf6b66.js +0 -3
- package/out/_next/static/chunks/50-586dc7ab5e584e76.js +0 -1
- package/out/_next/static/chunks/630-eae75e90b30f201a.js +0 -1
- package/out/_next/static/chunks/pages/changes-c58a60af39167147.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e6bc7cc6186d6a0f.js +0 -1
- package/out/_next/static/chunks/pages/slices-bf63f937b184b470.js +0 -1
- package/out/_next/static/chunks/webpack-e0c07a2fe4908d81.js +0 -1
- package/out/_next/static/css/cdee5b195444f185.css +0 -1
- package/src/features/environments/actions/useSetEnvironment.ts +0 -22
- package/src/features/errorBoundaries/AppStateErrorBoundary.tsx +0 -108
- package/src/features/errorBoundaries/index.ts +0 -2
- package/src/features/onboarding/useSharedOnboardingExperiment.ts +0 -6
- package/src/legacy/components/ChangesEmptyState/UnauthenticatedView.tsx +0 -31
- package/src/queryClient.tsx +0 -24
- /package/out/_next/static/{0C8VxwongjXZwHPchBnOi → 7uIqfRATU8iBj2XIUVUvD}/_ssgManifest.js +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
|
|
7
7
|
import { getState, telemetry } from "@/apiClient";
|
|
8
|
-
import {
|
|
8
|
+
import { setEnvironment } from "@/features/environments/actions/setEnvironment";
|
|
9
9
|
import { useActiveEnvironment } from "@/features/environments/useActiveEnvironment";
|
|
10
10
|
import { useEnvironments } from "@/features/environments/useEnvironments";
|
|
11
11
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
@@ -28,7 +28,6 @@ export function Environment() {
|
|
|
28
28
|
const authStatus = useAuthStatus();
|
|
29
29
|
const [isSwitchingEnv, setIsSwitchingEnv] = useState(false);
|
|
30
30
|
const { autoSyncStatus } = useAutoSync();
|
|
31
|
-
const setEnvironment = useSetEnvironment();
|
|
32
31
|
|
|
33
32
|
async function onSelect(environment: EnvironmentType) {
|
|
34
33
|
if (activeEnvironment?.name === environment.name) {
|
|
@@ -106,4 +105,10 @@ export function Environment() {
|
|
|
106
105
|
/>
|
|
107
106
|
);
|
|
108
107
|
}
|
|
108
|
+
|
|
109
|
+
if (useEnvironmentsError !== undefined) {
|
|
110
|
+
throw useEnvironmentsError;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
throw activeEnvironmentError;
|
|
109
114
|
}
|
package/src/legacy/components/Navigation/SideNavEnvironmentSelector/SideNavEnvironmentSelector.tsx
CHANGED
|
@@ -17,8 +17,9 @@ import * as VisuallyHidden from "@radix-ui/react-visually-hidden";
|
|
|
17
17
|
import type { Environment } from "@slicemachine/manager/client";
|
|
18
18
|
import { clsx } from "clsx";
|
|
19
19
|
import type { FC, ReactNode } from "react";
|
|
20
|
+
import { toast } from "react-toastify";
|
|
20
21
|
|
|
21
|
-
import {
|
|
22
|
+
import { LogoutButton } from "@/features/auth/LogoutButton";
|
|
22
23
|
import { LoginIcon } from "@/icons/LoginIcon";
|
|
23
24
|
import { LogoIcon } from "@/icons/LogoIcon";
|
|
24
25
|
|
|
@@ -29,7 +30,7 @@ type SideNavEnvironmentSelectorProps = {
|
|
|
29
30
|
disabled?: boolean;
|
|
30
31
|
environments?: Environment[];
|
|
31
32
|
loading?: boolean;
|
|
32
|
-
variant?: "default" | "offline" | "unauthenticated";
|
|
33
|
+
variant?: "default" | "offline" | "unauthorized" | "unauthenticated";
|
|
33
34
|
onLogInClick?: () => void;
|
|
34
35
|
onSelect?: (environment: Environment) => void | Promise<void>;
|
|
35
36
|
};
|
|
@@ -140,7 +141,11 @@ export const SideNavEnvironmentSelector: FC<SideNavEnvironmentSelectorProps> = (
|
|
|
140
141
|
/>
|
|
141
142
|
) : undefined}
|
|
142
143
|
|
|
143
|
-
{variant === "default" &&
|
|
144
|
+
{variant === "default" && (
|
|
145
|
+
<LogoutButton
|
|
146
|
+
onLogoutSuccess={() => toast.success("Logged out")}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
144
149
|
</Box>
|
|
145
150
|
</>
|
|
146
151
|
)}
|
|
@@ -17,7 +17,7 @@ import { toast } from "react-toastify";
|
|
|
17
17
|
import { BaseStyles, Box, Flex, Spinner } from "theme-ui";
|
|
18
18
|
|
|
19
19
|
import { saveSliceMock, telemetry } from "@/apiClient";
|
|
20
|
-
import {
|
|
20
|
+
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
21
21
|
import useThrottle from "@/hooks/useThrottle";
|
|
22
22
|
import ScreenshotPreviewModal from "@/legacy/components/ScreenshotPreviewModal";
|
|
23
23
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
@@ -287,7 +287,7 @@ const Simulator: FC<SimulatorProps> = ({ slice, variation }) => {
|
|
|
287
287
|
overflowY: "auto",
|
|
288
288
|
}}
|
|
289
289
|
>
|
|
290
|
-
<
|
|
290
|
+
<ErrorBoundary
|
|
291
291
|
renderError={() => (
|
|
292
292
|
<DefaultErrorMessage
|
|
293
293
|
title="Editor error"
|
|
@@ -315,7 +315,7 @@ const Simulator: FC<SimulatorProps> = ({ slice, variation }) => {
|
|
|
315
315
|
/>
|
|
316
316
|
</QueryClientProvider>
|
|
317
317
|
</Suspense>
|
|
318
|
-
</
|
|
318
|
+
</ErrorBoundary>
|
|
319
319
|
</Flex>
|
|
320
320
|
) : null}
|
|
321
321
|
</Flex>
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
reorderField,
|
|
21
21
|
updateField,
|
|
22
22
|
} from "@/domain/customType";
|
|
23
|
+
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
23
24
|
import { useCustomTypeState } from "@/features/customTypes/customTypesBuilder/CustomTypeProvider";
|
|
24
|
-
import { DefaultErrorBoundary } from "@/features/errorBoundaries";
|
|
25
25
|
import {
|
|
26
26
|
CustomTypes,
|
|
27
27
|
type TabField,
|
|
@@ -246,7 +246,7 @@ const TabZone: FC<TabZoneProps> = ({ tabId }) => {
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
return (
|
|
249
|
-
<
|
|
249
|
+
<ErrorBoundary>
|
|
250
250
|
<Suspense
|
|
251
251
|
fallback={
|
|
252
252
|
<Box padding={32}>
|
|
@@ -297,7 +297,7 @@ const TabZone: FC<TabZoneProps> = ({ tabId }) => {
|
|
|
297
297
|
/>
|
|
298
298
|
</List>
|
|
299
299
|
</Suspense>
|
|
300
|
-
</
|
|
300
|
+
</ErrorBoundary>
|
|
301
301
|
);
|
|
302
302
|
};
|
|
303
303
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UnauthenticatedError } from "@slicemachine/manager/client";
|
|
2
1
|
import { Reducer } from "redux";
|
|
3
2
|
import { ActionType, createAction, getType } from "typesafe-actions";
|
|
4
3
|
|
|
@@ -91,12 +90,13 @@ const getAuthStatus = (
|
|
|
91
90
|
): AuthStatus => {
|
|
92
91
|
switch (clientError?.status) {
|
|
93
92
|
case undefined: {
|
|
94
|
-
return AuthStatus.
|
|
93
|
+
return AuthStatus.AUTHORIZED;
|
|
94
|
+
}
|
|
95
|
+
case 403: {
|
|
96
|
+
return AuthStatus.UNAUTHORIZED;
|
|
95
97
|
}
|
|
96
98
|
case 401: {
|
|
97
|
-
|
|
98
|
-
return AuthStatus.UNAUTHENTICATED;
|
|
99
|
-
}
|
|
99
|
+
return AuthStatus.FORBIDDEN;
|
|
100
100
|
}
|
|
101
101
|
default: {
|
|
102
102
|
return AuthStatus.UNKNOWN;
|
package/src/pages/_app.tsx
CHANGED
|
@@ -13,33 +13,34 @@ import "@/styles/starry-night.css";
|
|
|
13
13
|
import "@/styles/tabs.css";
|
|
14
14
|
import "@/styles/toaster.css";
|
|
15
15
|
|
|
16
|
-
import { ThemeProvider, TooltipProvider } from "@prismicio/editor-ui";
|
|
17
16
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
Box,
|
|
18
|
+
DefaultErrorMessage,
|
|
19
|
+
ThemeProvider,
|
|
20
|
+
TooltipProvider,
|
|
21
|
+
} from "@prismicio/editor-ui";
|
|
22
|
+
import { ConnectedRouter } from "connected-next-router";
|
|
23
23
|
import type { NextPage } from "next";
|
|
24
24
|
import type { AppContext, AppInitialProps } from "next/app";
|
|
25
25
|
import dynamic from "next/dynamic";
|
|
26
26
|
import Head from "next/head";
|
|
27
27
|
import Router from "next/router";
|
|
28
|
-
import { type FC, type ReactNode, Suspense, useEffect } from "react";
|
|
28
|
+
import { type FC, type ReactNode, Suspense, useEffect, useState } from "react";
|
|
29
29
|
import { Provider } from "react-redux";
|
|
30
|
+
import type { Store } from "redux";
|
|
31
|
+
import type { Persistor } from "redux-persist/es/types";
|
|
30
32
|
import { PersistGate } from "redux-persist/integration/react";
|
|
31
33
|
import { ThemeProvider as ThemeUIThemeProvider, useThemeUI } from "theme-ui";
|
|
32
34
|
|
|
33
35
|
import { getState } from "@/apiClient";
|
|
34
|
-
import {
|
|
35
|
-
import { AppStateErrorBoundary } from "@/features/errorBoundaries";
|
|
36
|
+
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
36
37
|
import { AutoSyncProvider } from "@/features/sync/AutoSyncProvider";
|
|
37
38
|
import { RouteChangeProvider } from "@/hooks/useRouteChange";
|
|
38
39
|
import SliceMachineApp from "@/legacy/components/App";
|
|
39
40
|
import LoadingPage from "@/legacy/components/LoadingPage";
|
|
40
41
|
import ToastContainer from "@/legacy/components/ToasterContainer";
|
|
41
42
|
import { normalizeFrontendCustomTypes } from "@/legacy/lib/models/common/normalizers/customType";
|
|
42
|
-
import
|
|
43
|
+
import type ServerState from "@/legacy/lib/models/server/ServerState";
|
|
43
44
|
import configureStore from "@/redux/store";
|
|
44
45
|
import theme from "@/theme";
|
|
45
46
|
|
|
@@ -67,10 +68,50 @@ const RemoveDarkMode: FC<RemoveDarkModeProps> = ({ children }) => {
|
|
|
67
68
|
return <>{children}</>;
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
function App(
|
|
71
|
-
|
|
71
|
+
function App({
|
|
72
|
+
Component,
|
|
73
|
+
pageProps,
|
|
74
|
+
}: AppContextWithComponentLayout & AppInitialProps) {
|
|
75
|
+
const [serverState, setServerState] = useState<ServerState | null>(null);
|
|
76
|
+
const [smStore, setSMStore] = useState<{
|
|
77
|
+
store: Store;
|
|
78
|
+
persistor: Persistor;
|
|
79
|
+
} | null>(null);
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
async function getInitialState() {
|
|
83
|
+
const serverState = await getState();
|
|
84
|
+
setServerState(serverState);
|
|
85
|
+
}
|
|
86
|
+
void getInitialState();
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!serverState || smStore) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const normalizedCustomTypes = normalizeFrontendCustomTypes(
|
|
95
|
+
serverState.customTypes,
|
|
96
|
+
serverState.remoteCustomTypes,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const { store, persistor } = configureStore({
|
|
100
|
+
environment: serverState.env,
|
|
101
|
+
availableCustomTypes: {
|
|
102
|
+
...normalizedCustomTypes,
|
|
103
|
+
},
|
|
104
|
+
slices: {
|
|
105
|
+
libraries: serverState.libraries,
|
|
106
|
+
remoteSlices: serverState.remoteSlices,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
setSMStore({ store, persistor });
|
|
111
|
+
}, [serverState, smStore]);
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
114
|
+
const ComponentLayout = Component.CustomLayout || SliceMachineApp;
|
|
74
115
|
|
|
75
116
|
return (
|
|
76
117
|
<>
|
|
@@ -78,89 +119,50 @@ function App(props: AppContextWithComponentLayout & AppInitialProps) {
|
|
|
78
119
|
<title>Slice Machine</title>
|
|
79
120
|
</Head>
|
|
80
121
|
<ThemeUIThemeProvider theme={theme}>
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
<RemoveDarkMode>
|
|
123
|
+
<ThemeProvider mode="light">
|
|
124
|
+
<TooltipProvider>
|
|
125
|
+
{!smStore || !serverState ? (
|
|
126
|
+
<LoadingPage />
|
|
127
|
+
) : (
|
|
128
|
+
<Provider store={smStore.store}>
|
|
129
|
+
<ConnectedRouter Router={Router}>
|
|
130
|
+
<PersistGate loading={null} persistor={smStore.persistor}>
|
|
131
|
+
<ErrorBoundary
|
|
132
|
+
renderError={() => (
|
|
133
|
+
<Box
|
|
134
|
+
justifyContent="center"
|
|
135
|
+
width="100%"
|
|
136
|
+
padding={80}
|
|
137
|
+
>
|
|
138
|
+
<DefaultErrorMessage
|
|
139
|
+
title="Error"
|
|
140
|
+
description="An error occurred while rendering the app."
|
|
141
|
+
/>
|
|
142
|
+
</Box>
|
|
143
|
+
)}
|
|
144
|
+
>
|
|
145
|
+
<Suspense fallback={<LoadingPage />}>
|
|
146
|
+
<AutoSyncProvider>
|
|
147
|
+
<RouteChangeProvider>
|
|
148
|
+
<ComponentLayout>
|
|
149
|
+
<Component {...pageProps} />
|
|
150
|
+
</ComponentLayout>
|
|
151
|
+
</RouteChangeProvider>
|
|
152
|
+
</AutoSyncProvider>
|
|
153
|
+
</Suspense>
|
|
154
|
+
</ErrorBoundary>
|
|
155
|
+
</PersistGate>
|
|
156
|
+
</ConnectedRouter>
|
|
157
|
+
<ToastContainer />
|
|
158
|
+
</Provider>
|
|
159
|
+
)}
|
|
160
|
+
</TooltipProvider>
|
|
161
|
+
</ThemeProvider>
|
|
162
|
+
</RemoveDarkMode>
|
|
103
163
|
</ThemeUIThemeProvider>
|
|
104
164
|
</>
|
|
105
165
|
);
|
|
106
166
|
}
|
|
107
167
|
|
|
108
|
-
/** This is where we should check for unwanted states that should prevent the
|
|
109
|
-
* user from using the app, and trigger the {@link AppStateErrorBoundary} to
|
|
110
|
-
* display something explaining why. */
|
|
111
|
-
function AppStateValidator(props: { children: ReactNode }) {
|
|
112
|
-
const activeEnvironment = useActiveEnvironment({ suspense: true });
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
// We're using the fetchEnvironments request to check this because it can
|
|
116
|
-
// return an SMUnauthorizedError or SMInvalidActiveEnvironmentError
|
|
117
|
-
// according to the API response, so we handle both cases with just one
|
|
118
|
-
// request. We also perform the request in other parts of the app, so it can
|
|
119
|
-
// reuse its cache.
|
|
120
|
-
isUnauthorizedError(activeEnvironment.error) ||
|
|
121
|
-
isInvalidActiveEnvironmentError(activeEnvironment.error)
|
|
122
|
-
) {
|
|
123
|
-
throw activeEnvironment.error;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return <>{props.children}</>;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function AppStateWrapper({ children }: { children: ReactNode }) {
|
|
130
|
-
const { data: state } = useSuspenseQuery({
|
|
131
|
-
queryKey: ["getInitialState"],
|
|
132
|
-
queryFn: async () => {
|
|
133
|
-
const serverState = await getState();
|
|
134
|
-
const { store, persistor } = configureStore({
|
|
135
|
-
environment: serverState.env,
|
|
136
|
-
availableCustomTypes: {
|
|
137
|
-
...normalizeFrontendCustomTypes(
|
|
138
|
-
serverState.customTypes,
|
|
139
|
-
serverState.remoteCustomTypes,
|
|
140
|
-
),
|
|
141
|
-
},
|
|
142
|
-
slices: {
|
|
143
|
-
libraries: serverState.libraries,
|
|
144
|
-
remoteSlices: serverState.remoteSlices,
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
return { serverState, store, persistor };
|
|
149
|
-
},
|
|
150
|
-
// avoid refetching
|
|
151
|
-
staleTime: Infinity,
|
|
152
|
-
gcTime: Infinity,
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<Provider store={state.store}>
|
|
157
|
-
<StoreConnectedRouter Router={Router}>
|
|
158
|
-
<PersistGate loading={null} persistor={state.persistor}>
|
|
159
|
-
<RouteChangeProvider>{children}</RouteChangeProvider>
|
|
160
|
-
</PersistGate>
|
|
161
|
-
</StoreConnectedRouter>
|
|
162
|
-
</Provider>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
168
|
export default dynamic(() => Promise.resolve(App), { ssr: false });
|
package/src/pages/changes.tsx
CHANGED
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
AppLayoutHeader,
|
|
26
26
|
} from "@/legacy/components/AppLayout";
|
|
27
27
|
import {
|
|
28
|
+
AuthErrorPage,
|
|
28
29
|
OfflinePage,
|
|
29
|
-
UnauthenticatedView,
|
|
30
30
|
} from "@/legacy/components/ChangesEmptyState";
|
|
31
31
|
import { ChangesItems } from "@/legacy/components/ChangesItems";
|
|
32
32
|
import {
|
|
@@ -114,8 +114,8 @@ const Changes: React.FunctionComponent = () => {
|
|
|
114
114
|
if (!isOnline) {
|
|
115
115
|
return <OfflinePage />;
|
|
116
116
|
}
|
|
117
|
-
if (authStatus === AuthStatus.
|
|
118
|
-
return <
|
|
117
|
+
if (authStatus === AuthStatus.FORBIDDEN) {
|
|
118
|
+
return <AuthErrorPage authStatus={authStatus} />;
|
|
119
119
|
}
|
|
120
120
|
if (numberOfChanges === 0) {
|
|
121
121
|
return (
|
|
@@ -160,7 +160,8 @@ const Changes: React.FunctionComponent = () => {
|
|
|
160
160
|
disabled={
|
|
161
161
|
numberOfChanges === 0 ||
|
|
162
162
|
!isOnline ||
|
|
163
|
-
authStatus
|
|
163
|
+
authStatus === AuthStatus.UNAUTHORIZED ||
|
|
164
|
+
authStatus === AuthStatus.FORBIDDEN ||
|
|
164
165
|
isSyncing
|
|
165
166
|
}
|
|
166
167
|
loading={isSyncing}
|
|
@@ -5,8 +5,7 @@ import { Provider } from "react-redux";
|
|
|
5
5
|
import { AnyAction, Store } from "redux";
|
|
6
6
|
import { BaseStyles, ThemeProvider as ThemeUIThemeProvider } from "theme-ui";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { QueryClientProvider } from "@/queryClient";
|
|
8
|
+
import { ErrorBoundary } from "@/ErrorBoundary";
|
|
10
9
|
|
|
11
10
|
import configureStore from "../../src/redux/store";
|
|
12
11
|
import type { SliceMachineStoreType } from "../../src/redux/type";
|
|
@@ -45,17 +44,15 @@ function render(
|
|
|
45
44
|
children: any;
|
|
46
45
|
}) {
|
|
47
46
|
return (
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</ThemeUIThemeProvider>
|
|
58
|
-
</QueryClientProvider>
|
|
47
|
+
<ThemeUIThemeProvider theme={theme}>
|
|
48
|
+
<TooltipProvider>
|
|
49
|
+
<BaseStyles>
|
|
50
|
+
<Provider store={store}>
|
|
51
|
+
<ErrorBoundary>{children}</ErrorBoundary>
|
|
52
|
+
</Provider>
|
|
53
|
+
</BaseStyles>
|
|
54
|
+
</TooltipProvider>
|
|
55
|
+
</ThemeUIThemeProvider>
|
|
59
56
|
);
|
|
60
57
|
}
|
|
61
58
|
return {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,d,n,u,h,l,f,k,j,p,g,o,r,m){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,e,p,g,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,t,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-3901f2fc937d9648.js"],"/changes":[c,i,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-fa4f2563cb5fd014.js",a,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-c58a60af39167147.js"],"/custom-types":[s,e,p,g,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,n,u,h,l,s,t,b,f,o,a,e,k,j,r,m,"static/chunks/pages/custom-types/[customTypeId]-816acb31b652239b.js"],"/labs":["static/chunks/pages/labs-dd04033db23a58f3.js"],"/page-types/[pageTypeId]":[c,n,u,h,l,s,t,b,f,o,a,e,k,j,r,m,"static/chunks/pages/page-types/[pageTypeId]-669d5479e81b638b.js"],"/slices":[c,i,s,b,a,d,j,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-bf63f937b184b470.js"],"/slices/[lib]/[sliceName]/[variation]":[c,i,n,u,h,l,s,t,b,f,a,k,d,"static/css/cdee5b195444f185.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e6bc7cc6186d6a0f.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[i,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/429-1137c819c2bf6b66.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-f237aaa755dc9a99.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/34-50c64778da33cff6.js","static/chunks/647-4379a741c8d85d9e.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/50-586dc7ab5e584e76.js","static/chunks/658-8231c0b729e0124a.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/349-7118116b93278f73.js","static/chunks/630-eae75e90b30f201a.js","static/chunks/907-445266211c48b1a5.js","static/chunks/248-a9c33f7fbe2da2f1.js","static/css/4e475d945cf8a890.css","static/chunks/422-c9192a1dbdd2ae0e.js","static/chunks/489-a046ae0fa4f74435.js","static/css/56f2a6684a524374.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|