Skip to content

Commit

Permalink
BUGFIX: Recommending fix to minimized React 18 errors with nextjs & d…
Browse files Browse the repository at this point in the history
…efaultProps errors
  • Loading branch information
sengert-alliance committed Sep 24, 2024
1 parent 3ec12d7 commit c338fb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
6 changes: 1 addition & 5 deletions packages/sitecore-jss-nextjs/src/components/NextImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const NextImage: React.FC<NextImageProps> = ({
fill,
priority,
...otherProps
}) => {
} = {editable: true}) => {
// next handles src and we use a custom loader,
// throw error if these are present
if (otherProps.src) {
Expand Down Expand Up @@ -105,8 +105,4 @@ NextImage.propTypes = {
),
};

NextImage.defaultProps = {
editable: true,
};

NextImage.displayName = 'NextImage';
7 changes: 1 addition & 6 deletions packages/sitecore-jss-nextjs/src/components/RichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type RichTextProps = ReactRichTextProps & {

const prefetched: { [cacheKey: string]: boolean } = {};

export const RichText = (props: RichTextProps): JSX.Element => {
export const RichText = (props: RichTextProps = {tag: 'div', editable: true}): JSX.Element => {
const { internalLinksSelector = 'a[href^="/"]', prefetchLinks = true, ...rest } = props;
const hasText = props.field && props.field.value;
const isEditing = props.editable && props.field && props.field.editable;
Expand Down Expand Up @@ -77,9 +77,4 @@ RichText.propTypes = {
...RichTextPropTypes,
};

RichText.defaultProps = {
tag: 'div',
editable: true,
};

RichText.displayName = 'NextRichText';

0 comments on commit c338fb2

Please sign in to comment.