Skip to content

Commit

Permalink
fix: solve all problems that mentioned
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryWu1234 committed Jan 25, 2025
1 parent defcde7 commit 1d12ded
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions packages/qwik/src/core/shared/component-execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function addUseOnEvents(
useOnEvents: UseOnMap
): ValueOrPromise<JSXNodeInternal<string> | null | JSXOutput> {
const jsxElement = findFirstStringJSX(jsx);
let _jsx = jsx;
let jsxResult = jsx;
return maybeThen(jsxElement, (jsxElement) => {
let isInvisibleComponent = false;
if (!jsxElement) {
Expand All @@ -157,14 +157,14 @@ function addUseOnEvents(
if (Object.prototype.hasOwnProperty.call(useOnEvents, key)) {
if (isInvisibleComponent) {
if (key === 'onQvisible$') {
const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(_jsx);
_jsx = jsx;
const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
jsxResult = jsx;
if (jsxElement) {
addUseOnEvent(jsxElement, 'document:onQinit$', useOnEvents[key]);
}
} else if (key.startsWith('document:') || key.startsWith('window:')) {
const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(_jsx);
_jsx = jsx;
const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
jsxResult = jsx;
if (jsxElement) {
addUseOnEvent(jsxElement, key, useOnEvents[key]);
}
Expand All @@ -182,7 +182,7 @@ function addUseOnEvents(
}
}
}
return _jsx || jsx;
return jsxResult;
});
}

Expand Down Expand Up @@ -255,7 +255,7 @@ function addScriptNodeForInvisibleComponents(
return [jsxElement, jsx];
} else if (Array.isArray(jsx) && jsx.length) {
// get first element
const [jsxElement, _jsx] = addScriptNodeForInvisibleComponents(jsx[0]);
const [jsxElement, _] = addScriptNodeForInvisibleComponents(jsx[0]);
return [jsxElement, jsx];
}

Expand Down
2 changes: 1 addition & 1 deletion packages/qwik/src/core/ssr/ssr-render-jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function processJSXNode(
options.parentComponentFrame
);

const jsxOutput: any = applyQwikComponentBody(ssr, jsx, type);
const jsxOutput = applyQwikComponentBody(ssr, jsx, type);
const compStyleComponentId = addComponentStylePrefix(host.getProp(QScopedStyle));
enqueue(new ParentComponentData(options.styleScoped, options.parentComponentFrame));
enqueue(ssr.closeComponent);
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik/src/core/tests/use-on.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Error.stackTraceLimit = 100;

describe.each([
{ render: ssrRenderToDom }, //
{ render: domRender }, ///
{ render: domRender }, //
])('$render.name: useOn', ({ render }) => {
it('should update value', async () => {
const Counter = component$((props: { initial: number }) => {
Expand Down

0 comments on commit 1d12ded

Please sign in to comment.