Просмотр исходного кода

ReactMarkdown Components is not React.Memo

reiji-h 1 год назад
Родитель
Сommit
6f4f271e14

+ 2 - 2
apps/app/src/client/components/ReactMarkdownComponents/TableWithEditButton.tsx

@@ -23,7 +23,7 @@ type TableWithEditButtonProps = {
   className?: string
   className?: string
 }
 }
 
 
-export const TableWithEditButton = React.memo((props: TableWithEditButtonProps): JSX.Element => {
+export const TableWithEditButton = (props: TableWithEditButtonProps): JSX.Element => {
   const { children, node, className } = props;
   const { children, node, className } = props;
 
 
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isGuestUser } = useIsGuestUser();
@@ -60,5 +60,5 @@ export const TableWithEditButton = React.memo((props: TableWithEditButtonProps):
       </table>
       </table>
     </div>
     </div>
   );
   );
-}) as typeof TableWithEditButton;
+};
 TableWithEditButton.displayName = 'TableWithEditButton';
 TableWithEditButton.displayName = 'TableWithEditButton';

+ 6 - 6
packages/presentation/src/client/components/RichSlideSection.tsx

@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
 import React from 'react';
 import React from 'react';
 
 
 type RichSlideSectionProps = {
 type RichSlideSectionProps = {
-  children: ReactNode,
+  children?: ReactNode,
   presentation?: boolean,
   presentation?: boolean,
 }
 }
 
 
@@ -14,7 +14,7 @@ const OriginalRichSlideSection = React.memo((props: RichSlideSectionProps): JSX.
       <svg data-marpit-svg="" viewBox="0 0 1280 720">
       <svg data-marpit-svg="" viewBox="0 0 1280 720">
         <foreignObject width="1280" height="720">
         <foreignObject width="1280" height="720">
           <section>
           <section>
-            {children}
+            {children ?? <></>}
           </section>
           </section>
         </foreignObject>
         </foreignObject>
       </svg>
       </svg>
@@ -22,7 +22,7 @@ const OriginalRichSlideSection = React.memo((props: RichSlideSectionProps): JSX.
   );
   );
 });
 });
 
 
-export const RichSlideSection = React.memo((props: RichSlideSectionProps): JSX.Element => {
+export const RichSlideSection = (props: RichSlideSectionProps): JSX.Element => {
   const { children } = props;
   const { children } = props;
 
 
   return (
   return (
@@ -30,10 +30,10 @@ export const RichSlideSection = React.memo((props: RichSlideSectionProps): JSX.E
       {children}
       {children}
     </OriginalRichSlideSection>
     </OriginalRichSlideSection>
   );
   );
-}) as typeof RichSlideSection;
+};
 
 
 
 
-export const PresentationRichSlideSection = React.memo((props: RichSlideSectionProps): JSX.Element => {
+export const PresentationRichSlideSection = (props: RichSlideSectionProps): JSX.Element => {
   const { children } = props;
   const { children } = props;
 
 
   return (
   return (
@@ -41,4 +41,4 @@ export const PresentationRichSlideSection = React.memo((props: RichSlideSectionP
       {children}
       {children}
     </OriginalRichSlideSection>
     </OriginalRichSlideSection>
   );
   );
-}) as typeof PresentationRichSlideSection;
+};