Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions packages/react/runtime/src/lifecycle/isRendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ const setIsRendering = () => {
});
};

hook(options, RENDER_COMPONENT, (old, ...args) => {
const onRenderHook = <T extends unknown[]>(old: ((...args: T) => void) | undefined, ...args: T) => {
/* v8 ignore next */
old?.(...args);
if (old) old(...args);
setIsRendering();
});
};

hook(options, ROOT, (old, ...args) => {
/* v8 ignore next */
old?.(...args);
setIsRendering();
});
hook(options, RENDER_COMPONENT, onRenderHook);
hook(options, ROOT, onRenderHook);
19 changes: 5 additions & 14 deletions packages/react/runtime/src/lynx/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { options } from 'preact';
import type { VNode } from 'preact';

import { __globalSnapshotPatch } from '../lifecycle/patch/snapshotPatch.js';
import { RENDER_COMPONENT, ROOT } from '../renderToOpcodes/constants.js';
Expand Down Expand Up @@ -130,23 +129,15 @@ function initTimingAPI(): void {
}
};

hook(options, RENDER_COMPONENT, (old, vnode: VNode, c) => {
const onHook = <T extends unknown[]>(old: ((...args: T) => void) | undefined, ...args: T) => {
helper();
/* v8 ignore start */
if (old) {
old(vnode, c);
}
if (old) old(...args);
Comment thread
colinaaa marked this conversation as resolved.
/* v8 ignore stop */
});
};

hook(options, ROOT, (old, vnode: VNode, parentDom) => {
helper();
/* v8 ignore start */
if (old) {
old(vnode, parentDom);
}
/* v8 ignore stop */
});
hook(options, RENDER_COMPONENT, onHook);
hook(options, ROOT, onHook);
}

/**
Expand Down
Loading