From 7baba422814945a0c13829ab4d2ada641ec85a3b Mon Sep 17 00:00:00 2001
From: * <8>
Date: Thu, 14 Jul 2022 14:48:50 +0800
Subject: [PATCH 1/4] Match-id-8aa73ad0d48d2def8668dac345dcae9358eb62c9
---
libs/horizon/src/renderer/TreeBuilder.ts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libs/horizon/src/renderer/TreeBuilder.ts b/libs/horizon/src/renderer/TreeBuilder.ts
index c8b81ae7..683c9bc3 100644
--- a/libs/horizon/src/renderer/TreeBuilder.ts
+++ b/libs/horizon/src/renderer/TreeBuilder.ts
@@ -199,6 +199,10 @@ export function calcStartUpdateVNode(treeRoot: VNode) {
for (let i = 1; i < startNodePath.length; i++) {
const pathIndex = Number(startNodePath[i]);
node = getChildByIndex(node, pathIndex)!;
+ // 路径错误时,回退到从根更新
+ if (node == null) {
+ return treeRoot;
+ }
}
return node;
From 94eef7fa95d863680513e8bcdf98dadaa87c0ebd Mon Sep 17 00:00:00 2001
From: * <8>
Date: Thu, 14 Jul 2022 14:49:34 +0800
Subject: [PATCH 2/4] Match-id-7204860d15e5008d5a5bc4b77a5abe4855e17ff8
---
scripts/rollup/rollup.config.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/rollup/rollup.config.js b/scripts/rollup/rollup.config.js
index c3c31b49..290490e5 100644
--- a/scripts/rollup/rollup.config.js
+++ b/scripts/rollup/rollup.config.js
@@ -23,7 +23,8 @@ if (!fs.existsSync(outDir)) {
const outputResolve = (...p) => path.resolve(outDir, ...p);
function genConfig(mode) {
- const sourcemap = mode === 'development' ? 'inline' : false;
+ const isDev = mode === 'development';
+ const sourcemap = isDev ? 'inline' : false;
return {
input: path.resolve(libDir, 'index.ts'),
output: [
@@ -53,7 +54,8 @@ function genConfig(mode) {
replace({
values: {
'process.env.NODE_ENV': `"${mode}"`,
- isDev: 'true',
+ isDev: isDev.toString(),
+ isTest: false,
__VERSION__: `"${horizonVersion}"`,
},
preventAssignment: true,
From 02c598d8585547b381718f82c3e53c36aabadb94 Mon Sep 17 00:00:00 2001
From: * <8>
Date: Thu, 14 Jul 2022 14:51:51 +0800
Subject: [PATCH 3/4] Match-id-ea7fb2cf4b62d8a3051ace4f27a15d66601524a4
---
.../ComponentTest/ForwardRef.test.js | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 scripts/__tests__/ComponentTest/ForwardRef.test.js
diff --git a/scripts/__tests__/ComponentTest/ForwardRef.test.js b/scripts/__tests__/ComponentTest/ForwardRef.test.js
new file mode 100644
index 00000000..993d800a
--- /dev/null
+++ b/scripts/__tests__/ComponentTest/ForwardRef.test.js
@@ -0,0 +1,45 @@
+import * as Horizon from '@cloudsop/horizon/index.ts';
+import { getLogUtils } from '../jest/testUtils';
+
+describe('ForwardRef', () => {
+ const LogUtils = getLogUtils();
+ it('ForwardRef包裹的函数组件应该正常触发effect', () => {
+ function App(props, ref) {
+ Horizon.useEffect(() => {
+ LogUtils.log('effect');
+ return () => {
+ LogUtils.log('effect remove');
+ };
+ });
+ return ;
+ }
+
+ const Wrapper = Horizon.forwardRef(App);
+
+ Horizon.act(() => {
+ Horizon.render(