Skip to content

Commit

Permalink
fix: react 19 reconciler
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomura committed Nov 15, 2024
1 parent deb5c42 commit 75e5bf2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/examples/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"homepage": "https://github.com/diegomura/react-pdf#readme",
"repository": "[email protected]:diegomura/react-pdf.git",
"scripts": {
"dev": "vite ./src --open"
"dev": "vite ./src --open",
"build:site": "vite build ./src"
},
"dependencies": {
"@react-pdf/renderer": "^4.0.2"
Expand Down
11 changes: 10 additions & 1 deletion packages/reconciler/build/trim-reconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ const KEEP_OPTIONS = {
createTextInstance: true,
createInstance: true,
appendInitialChild: true,
noTimeout: true,
getCurrentUpdatePriority: true,
setCurrentUpdatePriority: true,
resolveUpdatePriority: true,
shouldAttemptEagerTransition: true,
requestPostPaintCallback: true,
maySuspendCommit: true,
};

const STATIC_OPTIONS = {
Expand All @@ -39,7 +46,9 @@ const STATIC_OPTIONS = {

const METHOD_KEYS = {
updateContainer: true,
updateContainerSync: true,
createContainer: true,
flushSyncWork: true,
};

function clearReconcilerOptions(path) {
Expand All @@ -48,7 +57,7 @@ function clearReconcilerOptions(path) {
const optionName = node.property?.name;

// If we are not visiting config object, skip.
if (objectName !== '$$$hostConfig') return;
if (objectName !== '$$$hostConfig' && objectName !== '$$$config') return;

// If it's an option we want to keep, skip.
if (KEEP_OPTIONS[optionName]) return;
Expand Down
4 changes: 2 additions & 2 deletions packages/reconciler/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default [
plugins: [
resolve({ resolveOnly: ['react-reconciler-31'] }),
commonjs({ esmExternals: (id) => id === 'scheduler' }),
// trimReconciler(),
// terser({ compress: { dead_code: true } }),
trimReconciler(),
terser({ compress: { dead_code: true } }),
],
},
];
5 changes: 2 additions & 3 deletions packages/reconciler/src/reconciler-31.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable import/extensions */
/* eslint-disable import/no-extraneous-dependencies */

import Reconciler from 'react-reconciler-31/cjs/react-reconciler.production.js';
import Reconciler from 'react-reconciler-31';
import {
ConcurrentRoot,
DefaultEventPriority,
} from 'react-reconciler-31/cjs/react-reconciler-constants.production.js';
} from 'react-reconciler-31/constants';

import propsEqual from './propsEqual';

Expand Down Expand Up @@ -84,7 +84,6 @@ const createRenderer = ({
};

return {
...reconciler,
createContainer,
updateContainer,
};
Expand Down

0 comments on commit 75e5bf2

Please sign in to comment.