-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): schedule qrls instead of direct call
- Loading branch information
Showing
13 changed files
with
124 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@qwik.dev/core': patch | ||
--- | ||
|
||
FIX: QRLs are now scheduled instead of directly executed by qwik-loader, so that they are executed in the right order. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { QError, qError } from '../shared/error/error'; | ||
import type { QRLInternal } from '../shared/qrl/qrl-class'; | ||
import { ChoreType } from '../shared/scheduler'; | ||
import { getInvokeContext } from '../use/use-core'; | ||
import { useLexicalScope } from '../use/use-lexical-scope.public'; | ||
import { _getQContainerElement, getDomContainer } from './dom-container'; | ||
|
||
/** | ||
* This is called by qwik-loader to schedule a QRL. It has to be synchronous. | ||
* | ||
* @internal | ||
*/ | ||
export const queueQRL = (...args: unknown[]) => { | ||
// This will already check container | ||
const [runQrl] = useLexicalScope<[QRLInternal<(...args: unknown[]) => unknown>]>(); | ||
const context = getInvokeContext(); | ||
const el = context.$element$!; | ||
const containerElement = _getQContainerElement(el) as HTMLElement; | ||
const container = getDomContainer(containerElement); | ||
|
||
const scheduler = container.$scheduler$; | ||
if (!scheduler) { | ||
throw qError(QError.schedulerNotFound); | ||
} | ||
|
||
return scheduler(ChoreType.RUN_QRL, null, runQrl, args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters