Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .changeset/non-qrl-api-compat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@qwik.dev/core': patch
'@qwik.dev/router': patch
'@qwik.dev/react': patch
---

feat: add non-QRL aliases for callback APIs
10 changes: 10 additions & 0 deletions e2e/qwik-e2e/apps/e2e/src/components/events/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const EventsParent = component$(() => {
passivePreventDefaultState: 'unset',
passiveDocumentCount: 0,
passiveWindowCount: 0,
qrlNoDollarClickCount: 0,
hoverOrderLog: '',
});
return (
Expand Down Expand Up @@ -190,6 +191,15 @@ const EventsParent = component$(() => {
</p>
<p id="count-passive-document">countPassiveDocument: {store.passiveDocumentCount}</p>
<p id="count-passive-window">countPassiveWindow: {store.passiveWindowCount}</p>
<button
id="qrl-no-dollar-click"
onClick={$(() => {
store.qrlNoDollarClickCount++;
})}
>
QRL no-dollar click
</button>
<p id="count-qrl-no-dollar-click">countQrlNoDollarClick: {store.qrlNoDollarClickCount}</p>
<UseOnWindowConditionalRenderIssue3948 />
<UndefinedEventHandler />
<ExecuteAllEventHandlers />
Expand Down
9 changes: 9 additions & 0 deletions e2e/qwik-e2e/tests/events.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ test.describe('events', () => {
await expect(page.locator('#hover-order-log')).toHaveText('red mouse out|blue mouse in');
});

test('should execute qrl handler passed to no-dollar event', async ({ page }) => {
const button = page.locator('#qrl-no-dollar-click');
const count = page.locator('#count-qrl-no-dollar-click');

await expect(count).toHaveText('countQrlNoDollarClick: 0');
await button.click();
await expect(count).toHaveText('countQrlNoDollarClick: 1');
});

test(`GIVEN "stoppropagation" is set as a attribute
THEN it should stop propagation`, async ({ page }) => {
const stoppedPropagationButton = page.locator('#stop-propagation');
Expand Down
112 changes: 112 additions & 0 deletions packages/docs/src/routes/api/qwik-router/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
"mdFile": "router.getvalidatortype.md"
},
{
"name": "globalAction",
"id": "globalaction",
"hierarchy": [
{
"name": "globalAction",
"id": "globalaction"
}
],
"kind": "Variable",
"content": "```typescript\nglobalAction: ActionConstructor & ActionConstructorQRL\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.globalaction.md"
},
{
"name": "globalAction$",
"id": "globalaction_",
Expand Down Expand Up @@ -842,6 +856,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
"mdFile": "router.resolveddocumenthead.md"
},
{
"name": "routeAction",
"id": "routeaction",
"hierarchy": [
{
"name": "routeAction",
"id": "routeaction"
}
],
"kind": "Variable",
"content": "```typescript\nrouteAction: ActionConstructor & ActionConstructorQRL\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.routeaction.md"
},
{
"name": "routeAction$",
"id": "routeaction_",
Expand Down Expand Up @@ -898,6 +926,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
"mdFile": "router.routedata.md"
},
{
"name": "routeLoader",
"id": "routeloader",
"hierarchy": [
{
"name": "routeLoader",
"id": "routeloader"
}
],
"kind": "Variable",
"content": "```typescript\nrouteLoader: LoaderConstructor & LoaderConstructorQRL\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.routeloader.md"
},
{
"name": "routeLoader$",
"id": "routeloader_",
Expand Down Expand Up @@ -954,6 +996,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/router-outlet-component.tsx",
"mdFile": "router.routeroutlet.md"
},
{
"name": "server",
"id": "server",
"hierarchy": [
{
"name": "server",
"id": "server"
}
],
"kind": "Function",
"content": "```typescript\nserver: <T extends ServerFunction>(fn: T | QRL<T>, options?: ServerConfig) => ServerQRL<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nfn\n\n\n</td><td>\n\nT \\| QRL&lt;T&gt;\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\noptions\n\n\n</td><td>\n\nServerConfig\n\n\n</td><td>\n\n_(Optional)_\n\n\n</td></tr>\n</tbody></table>\n\n**Returns:**\n\n[ServerQRL](#serverqrl)<!-- -->&lt;T&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.server.md"
},
{
"name": "server$",
"id": "server_",
Expand Down Expand Up @@ -1164,6 +1220,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/use-functions.ts",
"mdFile": "router.usenavigate.md"
},
{
"name": "usePreventNavigate",
"id": "usepreventnavigate",
"hierarchy": [
{
"name": "usePreventNavigate",
"id": "usepreventnavigate"
}
],
"kind": "Function",
"content": "```typescript\nusePreventNavigate: (fn: PreventNavigateCallback | QRL<PreventNavigateCallback>) => void\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nfn\n\n\n</td><td>\n\n[PreventNavigateCallback](#preventnavigatecallback) \\| QRL&lt;[PreventNavigateCallback](#preventnavigatecallback)<!-- -->&gt;\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n\n**Returns:**\n\nvoid",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/use-functions.ts",
"mdFile": "router.usepreventnavigate.md"
},
{
"name": "usePreventNavigate$",
"id": "usepreventnavigate_",
Expand Down Expand Up @@ -1192,6 +1262,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/qwik-router-component.tsx",
"mdFile": "router.useqwikrouter.md"
},
{
"name": "valibot",
"id": "valibot",
"hierarchy": [
{
"name": "valibot",
"id": "valibot"
}
],
"kind": "Variable",
"content": "> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\n\n\n```typescript\nvalibot: ValibotConstructor & ValibotConstructorQRL\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.valibot.md"
},
{
"name": "valibot$",
"id": "valibot_",
Expand All @@ -1206,6 +1290,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.valibot_.md"
},
{
"name": "validator",
"id": "validator",
"hierarchy": [
{
"name": "validator",
"id": "validator"
}
],
"kind": "Variable",
"content": "```typescript\nvalidator: ValidatorConstructor & ValidatorConstructorQRL\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.validator.md"
},
{
"name": "validator$",
"id": "validator_",
Expand Down Expand Up @@ -1262,6 +1360,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
"mdFile": "router.validatorreturn.md"
},
{
"name": "zod",
"id": "zod",
"hierarchy": [
{
"name": "zod",
"id": "zod"
}
],
"kind": "Variable",
"content": "```typescript\nzod: ZodConstructor & ZodConstructorQRL\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
"mdFile": "router.zod.md"
},
{
"name": "zod$",
"id": "zod_",
Expand Down
Loading
Loading