Skip to content

Commit 0c1b204

Browse files
authored
Merge pull request #10066 from neinteractiveliterature/renovate/major-react-monorepo
Update react monorepo to v19 (major)
2 parents 5e2ec52 + 18bdeaf commit 0c1b204

File tree

395 files changed

+862
-747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+862
-747
lines changed

app/javascript/AppRoot.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { initErrorReporting } from 'ErrorReporting';
1717

1818
export function buildAppRootContextValue(
1919
data: AppRootQueryData,
20-
navigationBarRef: RefObject<HTMLElement>,
20+
navigationBarRef: RefObject<HTMLElement | null>,
2121
): AppRootContextValue {
2222
return {
2323
assumedIdentityFromProfile: data.assumedIdentityFromProfile,
@@ -51,7 +51,7 @@ export function buildAppRootContextValue(
5151
};
5252
}
5353

54-
function AppRoot(): JSX.Element {
54+
function AppRoot(): React.JSX.Element {
5555
const location = useLocation();
5656
const navigate = useNavigate();
5757
const data = useLoaderData() as AppRootQueryData;

app/javascript/AppRootContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type AppRootContextValue = {
1919
hasOAuthApplications: boolean;
2020
language: string;
2121
myProfile?: NonNullable<AppRootQueryData['convention']>['my_profile'];
22-
navigationBarRef: RefObject<HTMLElement>;
22+
navigationBarRef: RefObject<HTMLElement | null>;
2323
rootSiteName?: string | null;
2424
signupMode?: SignupMode;
2525
signupAutomationMode?: SignupAutomationMode;

app/javascript/AppRootLayout.tsx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import React, { useEffect, useMemo, useState } from 'react';
1+
import { useEffect, useMemo, useState } from 'react';
22
import { LoaderFunction, useLoaderData } from 'react-router';
33
import parseCmsContent, { CMS_COMPONENT_MAP } from './parseCmsContent';
44
import OutletWithLoading from './OutletWithLoading';
55
import NavigationBar from './NavigationBar';
6-
import { ScriptTag } from './parsePageContent';
76
import { PageLoadingIndicator } from '@neinteractiveliterature/litform';
8-
import { Helmet } from 'react-helmet-async';
97
import { client } from './useIntercodeApolloClient';
108
import { AppRootLayoutQueryData, AppRootLayoutQueryDocument } from './appRootQueries.generated';
119

@@ -48,25 +46,6 @@ function AppRootLayout() {
4846
});
4947
}, [data.cmsParentByRequestHost.effectiveCmsLayout.content_html]);
5048

51-
const [headComponentsWithoutScriptTags, headScriptTags] = useMemo(() => {
52-
if (parsedCmsContent?.headComponents == null) {
53-
return [[], []];
54-
}
55-
56-
const nonScriptTags: React.ReactNode[] = [];
57-
const scriptTags: React.ReactNode[] = [];
58-
59-
React.Children.forEach(parsedCmsContent.headComponents, (child) => {
60-
if (React.isValidElement(child) && child.type === ScriptTag) {
61-
scriptTags.push(child);
62-
} else {
63-
nonScriptTags.push(child);
64-
}
65-
});
66-
67-
return [nonScriptTags, scriptTags];
68-
}, [parsedCmsContent?.headComponents]);
69-
7049
useEffect(() => {
7150
if (cachedCmsLayoutId !== data.cmsParentByRequestHost.effectiveCmsLayout.id) {
7251
if (cachedCmsLayoutId) {
@@ -89,9 +68,8 @@ function AppRootLayout() {
8968

9069
return (
9170
<>
92-
<Helmet>{headComponentsWithoutScriptTags}</Helmet>
93-
{headScriptTags}
94-
{parsedCmsContent?.bodyComponents}
71+
{parsedCmsContent.headComponents}
72+
{parsedCmsContent.bodyComponents}
9573
</>
9674
);
9775
}

app/javascript/AppWrapper.tsx

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
ErrorDisplay,
1515
ToastProvider,
1616
} from '@neinteractiveliterature/litform';
17-
import { HelmetProvider } from 'react-helmet-async';
1817

1918
import AuthenticationModalContext, {
2019
useAuthenticationModalProvider,
@@ -79,35 +78,33 @@ function ProviderStack(props: AppWrapperProps) {
7978

8079
return (
8180
<ApolloProvider client={client}>
82-
<HelmetProvider>
83-
{/* TODO bring this back when we re-add prompting getUserConfirmation={getUserConfirmation}> */}
84-
<RailsDirectUploadsContext.Provider value={railsDirectUploadsContextValue}>
85-
<AuthenticationModalContext.Provider value={authenticationModalContextValue}>
86-
<>
87-
{!unauthenticatedError && (
88-
<Suspense fallback={<PageLoadingIndicator visible iconSet="bootstrap-icons" />}>
89-
<I18NextWrapper>
90-
{(i18nInstance) => (
91-
<AlertProvider okText={i18nInstance.t('buttons.ok', 'OK')}>
92-
<ToastProvider
93-
formatTimeAgo={(timeAgo) =>
94-
DateTime.now().minus(Duration.fromMillis(timeAgo.milliseconds)).toRelative()
95-
}
96-
>
97-
<ErrorBoundary placement="replace" errorType="plain">
98-
<Outlet />
99-
</ErrorBoundary>
100-
</ToastProvider>
101-
</AlertProvider>
102-
)}
103-
</I18NextWrapper>
104-
</Suspense>
105-
)}
106-
<AuthenticationModal />
107-
</>
108-
</AuthenticationModalContext.Provider>
109-
</RailsDirectUploadsContext.Provider>
110-
</HelmetProvider>
81+
{/* TODO bring this back when we re-add prompting getUserConfirmation={getUserConfirmation}> */}
82+
<RailsDirectUploadsContext.Provider value={railsDirectUploadsContextValue}>
83+
<AuthenticationModalContext.Provider value={authenticationModalContextValue}>
84+
<>
85+
{!unauthenticatedError && (
86+
<Suspense fallback={<PageLoadingIndicator visible iconSet="bootstrap-icons" />}>
87+
<I18NextWrapper>
88+
{(i18nInstance) => (
89+
<AlertProvider okText={i18nInstance.t('buttons.ok', 'OK')}>
90+
<ToastProvider
91+
formatTimeAgo={(timeAgo) =>
92+
DateTime.now().minus(Duration.fromMillis(timeAgo.milliseconds)).toRelative()
93+
}
94+
>
95+
<ErrorBoundary placement="replace" errorType="plain">
96+
<Outlet />
97+
</ErrorBoundary>
98+
</ToastProvider>
99+
</AlertProvider>
100+
)}
101+
</I18NextWrapper>
102+
</Suspense>
103+
)}
104+
<AuthenticationModal />
105+
</>
106+
</AuthenticationModalContext.Provider>
107+
</RailsDirectUploadsContext.Provider>
111108
</ApolloProvider>
112109
);
113110
}
@@ -123,7 +120,7 @@ export type AppWrapperProps = {
123120
stripePublishableKey: string;
124121
};
125122

126-
function AppWrapper<P extends JSX.IntrinsicAttributes>(
123+
function AppWrapper<P extends React.JSX.IntrinsicAttributes>(
127124
WrappedComponent: React.ComponentType<P>,
128125
): React.ComponentType<P> {
129126
function Wrapper(props: P & AppWrapperProps) {

app/javascript/Authentication/AccountFormContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AccountFormContentQueryDocument } from './queries.generated';
33
import BlockPartial from 'UIComponents/BlockPartial';
44
import { CmsPartialBlockName } from 'graphqlTypes.generated';
55

6-
function AccountFormContent(): JSX.Element {
6+
function AccountFormContent(): React.JSX.Element {
77
const { data, loading, error } = useQuery(AccountFormContentQueryDocument);
88

99
if (error || loading || !data) {

app/javascript/Authentication/AuthenticationModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const ForgotPasswordForm = lazyWithAppEntrypointHeadersCheck(() => import('./For
88
const SignInForm = lazyWithAppEntrypointHeadersCheck(() => import('./SignInForm'));
99
const SignUpForm = lazyWithAppEntrypointHeadersCheck(() => import('./SignUpForm'));
1010

11-
function AuthenticationModal(): JSX.Element {
11+
function AuthenticationModal(): React.JSX.Element {
1212
const { visible, currentView } = useContext(AuthenticationModalContext);
1313

1414
const renderView = () => {

app/javascript/Authentication/ForgotPasswordForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function resetPassword(authenticityToken: string, email: string) {
4141
return responseJson;
4242
}
4343

44-
function ForgotPasswordForm(): JSX.Element {
44+
function ForgotPasswordForm(): React.JSX.Element {
4545
const { t } = useTranslation();
4646
const { close: closeModal, setCurrentView } = useContext(AuthenticationModalContext);
4747
const authenticityToken = AuthenticityTokensManager.instance.tokens.resetPassword;

app/javascript/Authentication/PasswordConfirmationInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type PasswordConfirmationInputProps = {
1010
password: string;
1111
};
1212

13-
function PasswordConfirmationInput({ value, onChange, password }: PasswordConfirmationInputProps): JSX.Element {
13+
function PasswordConfirmationInput({ value, onChange, password }: PasswordConfirmationInputProps): React.JSX.Element {
1414
const { t } = useTranslation();
1515
const [interactedWithConfirmation, setInteractedWithConfirmation] = useState(false);
1616

app/javascript/Authentication/PasswordInputWithStrengthCheck.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ export type PasswordInputWithStrengthCheckProps = {
6060
onChange: React.Dispatch<string>;
6161
};
6262

63-
function PasswordInputWithStrengthCheck({ id, value, onChange }: PasswordInputWithStrengthCheckProps): JSX.Element {
63+
function PasswordInputWithStrengthCheck({
64+
id,
65+
value,
66+
onChange,
67+
}: PasswordInputWithStrengthCheckProps): React.JSX.Element {
6468
const { t } = useTranslation();
6569
const passwordStrengthResult = useMemo(() => zxcvbn(value), [value]);
6670
const hasFeedback = useMemo(

app/javascript/Authentication/ResetPassword.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function changePassword(
3535
}
3636
}
3737

38-
function ResetPassword(): JSX.Element {
38+
function ResetPassword(): React.JSX.Element {
3939
const { t } = useTranslation();
4040
const location = useLocation();
4141
const resetPasswordToken = useMemo(

0 commit comments

Comments
 (0)