Skip to content

Commit 0908779

Browse files
authored
fix: Use @preact/signals-react-transform (#19639)
* fix: Use @preact/signals-react-transform This is to be able to remove usage of installAutoSignalTracking in Hilla, which will not work with React 19, as stated in preactjs/signals#576 * fix test
1 parent 04a116f commit 0908779

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎flow-server/src/main/resources/com/vaadin/flow/server/frontend/dependencies/vite/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"devDependencies": {
1313
"vite": "5.3.1",
1414
"@vitejs/plugin-react": "4.3.1",
15+
"@preact/signals-react-transform": "0.3.1",
1516
"@rollup/plugin-replace": "5.0.7",
1617
"@rollup/pluginutils": "5.1.0",
1718
"@babel/preset-react": "7.24.7",

‎flow-server/src/main/resources/plugins/react-function-location-plugin/react-function-location-plugin.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export function addFunctionComponentSourceLocationBabel() {
6666
return;
6767
}
6868
const filename = state.file.opts.filename;
69-
addDebugInfo(path, name, filename, node.body.loc);
69+
if (node.body.loc) {
70+
addDebugInfo(path, name, filename, node.body.loc);
71+
}
7072
}
7173
}
7274
};

‎flow-server/src/main/resources/vite.generated.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,13 @@ export const vaadinConfig: UserConfigFn = (env) => {
784784
presets: [['@babel/preset-react', { runtime: 'automatic', development: !productionMode }]],
785785
// React writes the source location for where components are used, this writes for where they are defined
786786
plugins: [
787-
!productionMode && addFunctionComponentSourceLocationBabel()
787+
!productionMode && addFunctionComponentSourceLocationBabel(),
788+
[
789+
'module:@preact/signals-react-transform',
790+
{
791+
mode: 'all' // Needed to include translations which do not use something.value
792+
}
793+
]
788794
].filter(Boolean)
789795
}
790796
}),

‎flow-server/src/test/java/com/vaadin/flow/server/frontend/NodeUpdaterTest.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public void getDefaultDevDependencies_includesAllDependencies_whenUsingVite() {
147147
expectedDependencies.add("@babel/preset-react");
148148
expectedDependencies.add("@types/react");
149149
expectedDependencies.add("@types/react-dom");
150+
expectedDependencies.add("@preact/signals-react-transform");
150151

151152
Set<String> actualDependendencies = defaultDeps.keySet();
152153

0 commit comments

Comments
 (0)