[Glitch] Upgrades to React 19.2
Port ccd6fb92f9 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
1 parent
1e7fec004d
commit
cc2aec8b0a
2 files changed
+22
-16
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import type { ComponentType, ReactNode } from 'react';
|
||||
|
||||
import { defineMessage, FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
@@ -143,6 +144,21 @@ const FilteredQuote: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
// Adds a wrapper around StatusContainer as the types aren't inheriting correctly with Redux + React 19.
|
||||
// TODO: Remove this after the Status component is in TS.
|
||||
interface StatusContainerForQuotesProps {
|
||||
id?: string | null;
|
||||
contextType?: string;
|
||||
isQuotedPost?: boolean;
|
||||
avatarSize?: number;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
children?: ReactNode;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
const StatusContainerWithChildren =
|
||||
StatusContainer as unknown as ComponentType<StatusContainerForQuotesProps>;
|
||||
|
||||
interface QuotedStatusProps {
|
||||
quote: QuoteMap;
|
||||
contextType?: string;
|
||||
@@ -339,7 +355,7 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
|
||||
return (
|
||||
<div className='status__quote'>
|
||||
<StatusContainer
|
||||
<StatusContainerWithChildren
|
||||
isQuotedPost
|
||||
id={quotedStatusId}
|
||||
contextType={contextType}
|
||||
@@ -357,7 +373,7 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
nestingLevel={nestingLevel + 1}
|
||||
/>
|
||||
)}
|
||||
</StatusContainer>
|
||||
</StatusContainerWithChildren>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -384,17 +400,15 @@ export const StatusQuoteManager = (props: StatusQuoteManagerProps) => {
|
||||
|
||||
if (quote) {
|
||||
return (
|
||||
/* @ts-expect-error Status is not yet typed */
|
||||
<StatusContainer {...props}>
|
||||
<StatusContainerWithChildren {...props}>
|
||||
<QuotedStatus
|
||||
quote={quote}
|
||||
parentQuotePostId={status?.get('id') as string}
|
||||
contextType={props.contextType}
|
||||
/>
|
||||
</StatusContainer>
|
||||
</StatusContainerWithChildren>
|
||||
);
|
||||
}
|
||||
|
||||
/* @ts-expect-error Status is not yet typed */
|
||||
return <StatusContainer {...props} />;
|
||||
return <StatusContainerWithChildren {...props} />;
|
||||
};
|
||||
@@ -18,7 +18,7 @@ export const WithOptionalRouterPropTypes = {
|
||||
|
||||
export interface OptionalRouterProps {
|
||||
ref: unknown;
|
||||
wrappedComponentRef: unknown;
|
||||
wrappedComponentRef?: string | ((...args: unknown[]) => unknown) | object;
|
||||
}
|
||||
|
||||
// This is copied from https://github.com/remix-run/react-router/blob/v5.3.4/packages/react-router/modules/withRouter.js
|
||||
@@ -54,14 +54,6 @@ export function withOptionalRouter<
|
||||
|
||||
C.displayName = displayName;
|
||||
C.WrappedComponent = Component;
|
||||
C.propTypes = {
|
||||
...Component.propTypes,
|
||||
wrappedComponentRef: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.object,
|
||||
]),
|
||||
};
|
||||
|
||||
return hoistStatics(C, Component);
|
||||
}
|
||||
Reference in new issue
Block a user