From 2469b8bbfe538d41903486b4c09975f3d6806142 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Thu, 6 Apr 2023 16:19:36 -0400 Subject: [PATCH] Fix react warning, fix dom issues --- packages/core/src/bootstrap.tsx | 14 ++++++++++++++ .../collections/entries/EntryListing.tsx | 10 +++++++--- packages/core/src/components/navbar/Sidebar.tsx | 13 ++++++------- .../core/src/widgets/markdown/plate/plateTypes.ts | 2 +- yarn.lock | 8 ++++---- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/packages/core/src/bootstrap.tsx b/packages/core/src/bootstrap.tsx index 40b33cd0..ff392c62 100644 --- a/packages/core/src/bootstrap.tsx +++ b/packages/core/src/bootstrap.tsx @@ -31,6 +31,20 @@ import './styles/main.css'; const ROOT_ID = 'nc-root'; +/** + * Very hacky. This suppresses the "You are importing createRoot from "react-dom" which + * is not supported. You should instead import it from "react-dom/client"." warning. + * + * Not sure why this is necessary as we import from "react-dom/client" as we should. + */ +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +// eslint-disable-next-line @typescript-eslint/no-unused-vars, import/order +import ReactDOM from 'react-dom'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = true; + const TranslatedApp = ({ locale, config }: AppRootProps) => { if (!config) { return null; diff --git a/packages/core/src/components/collections/entries/EntryListing.tsx b/packages/core/src/components/collections/entries/EntryListing.tsx index 824fcf73..8ba4d076 100644 --- a/packages/core/src/components/collections/entries/EntryListing.tsx +++ b/packages/core/src/components/collections/entries/EntryListing.tsx @@ -122,10 +122,14 @@ const EntryListing = ({ if (viewStyle === 'VIEW_STYLE_LIST') { return ( - - {renderedCards} + <> +
+ {renderedCards} +
{hasMore && handleLoadMore && } - + ); } diff --git a/packages/core/src/components/navbar/Sidebar.tsx b/packages/core/src/components/navbar/Sidebar.tsx index d6965840..9af16b49 100644 --- a/packages/core/src/components/navbar/Sidebar.tsx +++ b/packages/core/src/components/navbar/Sidebar.tsx @@ -40,13 +40,12 @@ const Sidebar: FC = ({ t }) => { if ('nested' in collection) { return ( -
  • - -
  • + ); } diff --git a/packages/core/src/widgets/markdown/plate/plateTypes.ts b/packages/core/src/widgets/markdown/plate/plateTypes.ts index 05b2a2e2..3112af74 100644 --- a/packages/core/src/widgets/markdown/plate/plateTypes.ts +++ b/packages/core/src/widgets/markdown/plate/plateTypes.ts @@ -78,7 +78,7 @@ import type { TText, WithOverride, } from '@udecode/plate'; -import type { CSSProperties } from 'styled-components'; +import type { CSSProperties } from 'react'; export const ELEMENT_SHORTCODE = 'shortcode' as const; diff --git a/yarn.lock b/yarn.lock index 8007ace3..50b34980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6155,14 +6155,14 @@ babel-plugin-react-svg@^3.0.3: integrity sha512-Pst1RWjUIiV0Ykv1ODSeceCBsFOP2Y4dusjq7/XkjuzJdvS9CjpkPMUIoO4MLlvp5PiLCeMlsOC7faEUA0gm3Q== "babel-plugin-styled-components@>= 1.12.0": - version "2.0.7" - resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-2.0.7.tgz#c81ef34b713f9da2b7d3f5550df0d1e19e798086" - integrity sha512-i7YhvPgVqRKfoQ66toiZ06jPNA3p6ierpfUuEWxNF+fV27Uv5gxBkf8KZLHUCc1nFA9j6+80pYoIpqCeyW3/bA== + version "2.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-2.1.1.tgz#cd977cc0ff8410d5cbfdd142e42576e9c8794b87" + integrity sha512-c8lJlszObVQPguHkI+akXv8+Jgb9Ccujx0EetL7oIvwU100LxO6XAGe45qry37wUL40a5U9f23SYrivro2XKhA== dependencies: "@babel/helper-annotate-as-pure" "^7.16.0" "@babel/helper-module-imports" "^7.16.0" babel-plugin-syntax-jsx "^6.18.0" - lodash "^4.17.11" + lodash "^4.17.21" picomatch "^2.3.0" babel-plugin-syntax-export-extensions@^6.8.0: