Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
coderinblack08 committed Jul 21, 2022
1 parent 5b774bc commit 5e643c2
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 7 deletions.
19 changes: 12 additions & 7 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
const withTM = require("next-transpile-modules")(["ui"]);
const { env } = require("./server/env");

module.exports = withTM({
reactStrictMode: true,
publicRuntimeConfig: {
NODE_ENV: env.NODE_ENV,
},
experimental: { images: { allowFutureImage: true } },
});
module.exports = withTM(
/**
* @type {import('next').NextConfig}
*/
{
reactStrictMode: true,
publicRuntimeConfig: {
NODE_ENV: env.NODE_ENV,
},
experimental: { images: { allowFutureImage: true, esmExternals: true } },
}
);
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"devDependencies": {
"autoprefixer": "^10.4.7",
"eslint-config-custom": "*",
"patch-package": "^6.4.7",
"postcss": "^8.4.14",
"postinstall-postinstall": "^2.1.0",
"prettier": "latest",
"tailwindcss": "^3.1.6",
"turbo": "latest"
Expand Down
96 changes: 96 additions & 0 deletions patches/@tiptap+react+2.0.0-beta.114.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
diff --git a/node_modules/@tiptap/react/dist/tiptap-react.cjs.js b/node_modules/@tiptap/react/dist/tiptap-react.cjs.js
index 1ef7c04..43df405 100644
--- a/node_modules/@tiptap/react/dist/tiptap-react.cjs.js
+++ b/node_modules/@tiptap/react/dist/tiptap-react.cjs.js
@@ -192,11 +192,13 @@ class ReactRenderer {
};
}
this.reactElement = React__default["default"].createElement(Component, { ...props });
- if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
- this.editor.contentComponent.setState({
- renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
- });
- }
+ ReactDOM.flushSync(() => {
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
+ this.editor.contentComponent.setState({
+ renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
+ });
+ }
+ });
}
updateProps(props = {}) {
this.props = {
@@ -206,14 +208,16 @@ class ReactRenderer {
this.render();
}
destroy() {
- var _a;
- if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
- const { renderers } = this.editor.contentComponent.state;
- renderers.delete(this.id);
- this.editor.contentComponent.setState({
- renderers,
- });
- }
+ ReactDOM.flushSync(() => {
+ var _a;
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
+ const { renderers } = this.editor.contentComponent.state;
+ renderers.delete(this.id);
+ this.editor.contentComponent.setState({
+ renderers,
+ });
+ }
+ });
}
}

diff --git a/node_modules/@tiptap/react/dist/tiptap-react.esm.js b/node_modules/@tiptap/react/dist/tiptap-react.esm.js
index 505e75a..d3a89dd 100644
--- a/node_modules/@tiptap/react/dist/tiptap-react.esm.js
+++ b/node_modules/@tiptap/react/dist/tiptap-react.esm.js
@@ -184,11 +184,13 @@ class ReactRenderer {
};
}
this.reactElement = React.createElement(Component, { ...props });
- if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
- this.editor.contentComponent.setState({
- renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
- });
- }
+ ReactDOM.flushSync(() => {
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
+ this.editor.contentComponent.setState({
+ renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
+ });
+ }
+ });
}
updateProps(props = {}) {
this.props = {
@@ -198,14 +200,16 @@ class ReactRenderer {
this.render();
}
destroy() {
- var _a;
- if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
- const { renderers } = this.editor.contentComponent.state;
- renderers.delete(this.id);
- this.editor.contentComponent.setState({
- renderers,
- });
- }
+ ReactDOM.flushSync(() => {
+ var _a;
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
+ const { renderers } = this.editor.contentComponent.state;
+ renderers.delete(this.id);
+ this.editor.contentComponent.setState({
+ renderers,
+ });
+ }
+ });
}
}

0 comments on commit 5e643c2

Please sign in to comment.