Skip to content

Commit

Permalink
fix(plugin): render mention identity user, react 18 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony authored Jun 2, 2023
1 parent d5ac67c commit d07b94c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 41 deletions.
7 changes: 4 additions & 3 deletions demo/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
import App from "./App";

ReactDOM.render(
const root = createRoot(document.getElementById("root")!);

root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")!
);
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
"devDependencies": {
"@types/marked": "^4.0.3",
"@types/prismjs": "^1.26.0",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"@types/sanitize-html": "^2.6.2",
"@types/styled-components": "^5.1.25",
"@vitejs/plugin-react": "^1.3.0",
"prettier": "^2.7.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.5",
"tsup": "^6.1.2",
"typescript": "^4.6.3",
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/renderMentionIdentityUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// parse markdown link `[@DisplayName](Address-Network)`
// to `<MentionIdentityUser />` and pass address, network to the component

import { render } from "react-dom";
import { createRoot } from "react-dom/client";
import type { Plugin } from "../types";
import React, { cloneElement } from "react";

Expand Down Expand Up @@ -96,12 +96,12 @@ export function renderMentionIdentityUserPlugin(
const network = t.getAttribute(targetElement.networkAttr);

const { el } = createAppContainer();
render(
const targetRoot = createRoot(el);
targetRoot.render(
cloneElement(IdentityComponent, {
address,
network,
}),
el,
);

t.replaceWith(el);
Expand Down
59 changes: 28 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,16 @@ __metadata:
dependencies:
"@types/marked": ^4.0.3
"@types/prismjs": ^1.26.0
"@types/react": ^17.0.2
"@types/react-dom": ^17.0.2
"@types/react": ^18.2.8
"@types/react-dom": ^18.2.4
"@types/sanitize-html": ^2.6.2
"@types/styled-components": ^5.1.25
"@vitejs/plugin-react": ^1.3.0
marked: ^4.0.17
prettier: ^2.7.1
prismjs: ^1.28.0
react: ^17.0.2
react-dom: ^17.0.2
react: ^18.2.0
react-dom: ^18.2.0
sanitize-html: ^2.7.0
styled-components: ^5.3.5
tsup: ^6.1.2
Expand Down Expand Up @@ -544,12 +544,12 @@ __metadata:
languageName: node
linkType: hard

"@types/react-dom@npm:^17.0.2":
version: 17.0.17
resolution: "@types/react-dom@npm:17.0.17"
"@types/react-dom@npm:^18.2.4":
version: 18.2.4
resolution: "@types/react-dom@npm:18.2.4"
dependencies:
"@types/react": ^17
checksum: 23caf98aa03e968811560f92a2c8f451694253ebe16b670929b24eaf0e7fa62ba549abe9db0ac028a9d8a9086acd6ab9c6c773f163fa21224845edbc00ba6232
"@types/react": "*"
checksum: 8301f35cf1cbfec8c723e9477aecf87774e3c168bd457d353b23c45064737213d3e8008b067c6767b7b08e4f2b3823ee239242a6c225fc91e7f8725ef8734124
languageName: node
linkType: hard

Expand All @@ -564,14 +564,14 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^17, @types/react@npm:^17.0.2":
version: 17.0.47
resolution: "@types/react@npm:17.0.47"
"@types/react@npm:^18.2.8":
version: 18.2.8
resolution: "@types/react@npm:18.2.8"
dependencies:
"@types/prop-types": "*"
"@types/scheduler": "*"
csstype: ^3.0.2
checksum: 2e7fe0eb630cb77da03b6da308c58728c01b38e878118e9ff5cd8045181c8d4f32dc936e328f46a62cadb56e1fe4c5a911b5113584f93a99e1f35df7f059246b
checksum: 351fe2450d30bff2ceb6aa84788e948317555e5ea22cb44f6778e08c977aab1878a0119bd94bc3d1bec5f5af4a75ffaa2ce111df5cd9d4ce26bfd719e4d971c2
languageName: node
linkType: hard

Expand Down Expand Up @@ -2138,7 +2138,7 @@ __metadata:
languageName: node
linkType: hard

"object-assign@npm:^4.0.1, object-assign@npm:^4.1.1":
"object-assign@npm:^4.0.1":
version: 4.1.1
resolution: "object-assign@npm:4.1.1"
checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f
Expand Down Expand Up @@ -2311,16 +2311,15 @@ __metadata:
languageName: node
linkType: hard

"react-dom@npm:^17.0.2":
version: 17.0.2
resolution: "react-dom@npm:17.0.2"
"react-dom@npm:^18.2.0":
version: 18.2.0
resolution: "react-dom@npm:18.2.0"
dependencies:
loose-envify: ^1.1.0
object-assign: ^4.1.1
scheduler: ^0.20.2
scheduler: ^0.23.0
peerDependencies:
react: 17.0.2
checksum: 1c1eaa3bca7c7228d24b70932e3d7c99e70d1d04e13bb0843bbf321582bc25d7961d6b8a6978a58a598af2af496d1cedcfb1bf65f6b0960a0a8161cb8dab743c
react: ^18.2.0
checksum: 7d323310bea3a91be2965f9468d552f201b1c27891e45ddc2d6b8f717680c95a75ae0bc1e3f5cf41472446a2589a75aed4483aee8169287909fcd59ad149e8cc
languageName: node
linkType: hard

Expand All @@ -2338,13 +2337,12 @@ __metadata:
languageName: node
linkType: hard

"react@npm:^17.0.2":
version: 17.0.2
resolution: "react@npm:17.0.2"
"react@npm:^18.2.0":
version: 18.2.0
resolution: "react@npm:18.2.0"
dependencies:
loose-envify: ^1.1.0
object-assign: ^4.1.1
checksum: b254cc17ce3011788330f7bbf383ab653c6848902d7936a87b09d835d091e3f295f7e9dd1597c6daac5dc80f90e778c8230218ba8ad599f74adcc11e33b9d61b
checksum: 88e38092da8839b830cda6feef2e8505dec8ace60579e46aa5490fc3dc9bba0bd50336507dc166f43e3afc1c42939c09fe33b25fae889d6f402721dcd78fca1b
languageName: node
linkType: hard

Expand Down Expand Up @@ -2484,13 +2482,12 @@ __metadata:
languageName: node
linkType: hard

"scheduler@npm:^0.20.2":
version: 0.20.2
resolution: "scheduler@npm:0.20.2"
"scheduler@npm:^0.23.0":
version: 0.23.0
resolution: "scheduler@npm:0.23.0"
dependencies:
loose-envify: ^1.1.0
object-assign: ^4.1.1
checksum: c4b35cf967c8f0d3e65753252d0f260271f81a81e427241295c5a7b783abf4ea9e905f22f815ab66676f5313be0a25f47be582254db8f9241b259213e999b8fc
checksum: d79192eeaa12abef860c195ea45d37cbf2bbf5f66e3c4dcd16f54a7da53b17788a70d109ee3d3dde1a0fd50e6a8fc171f4300356c5aee4fc0171de526bf35f8a
languageName: node
linkType: hard

Expand Down

0 comments on commit d07b94c

Please sign in to comment.