diff --git a/packages/docs/src/routes/api/qwik-city/api.json b/packages/docs/src/routes/api/qwik-city/api.json index f35a3cdce25..84cedf64372 100644 --- a/packages/docs/src/routes/api/qwik-city/api.json +++ b/packages/docs/src/routes/api/qwik-city/api.json @@ -2,23 +2,6 @@ "id": "qwik-city", "package": "@builder.io/qwik-city", "members": [ - { - "name": "\"link:app\"", - "id": "linkprops-_link_app_", - "hierarchy": [ - { - "name": "LinkProps", - "id": "linkprops-_link_app_" - }, - { - "name": "\"link:app\"", - "id": "linkprops-_link_app_" - } - ], - "kind": "PropertySignature", - "content": "```typescript\n'link:app'?: boolean;\n```", - "mdFile": "qwik-city.linkprops._link_app_.md" - }, { "name": "Action", "id": "action", @@ -379,7 +362,7 @@ } ], "kind": "Interface", - "content": "```typescript\nexport interface LinkProps extends AnchorAttributes \n```\n**Extends:** AnchorAttributes\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [\"link:app\"?](#linkprops-_link_app_) | | boolean | _(Optional)_ |\n| [prefetch?](#) | | boolean \\| 'js' |

_(Optional)_ \\*\\*Defaults to \\_true\\_.\\*\\*

Whether Qwik should prefetch and cache the target page of this \\*\\*Link\\*\\*, this includes invoking any \\*\\*routeLoader$\\*\\*, \\*\\*onGet\\*\\*, etc.

This \\*\\*improves UX performance\\*\\* for client-side (\\*\\*SPA\\*\\*) navigations.

Prefetching occurs when a the Link enters the viewport in production (\\*\\*on:qvisibile\\*\\*), or with \\*\\*mouseover/focus\\*\\* during dev.

Prefetching will not occur if the user has the \\*\\*data saver\\*\\* setting enabled.

Setting this value to \\*\\*"js"\\*\\* will prefetch only javascript bundles required to render this page on the client, \\*\\*false\\*\\* will disable prefetching altogether.

|\n| [reload?](#) | | boolean | _(Optional)_ |\n| [replaceState?](#) | | boolean | _(Optional)_ |\n| [scroll?](#) | | boolean | _(Optional)_ |", + "content": "```typescript\nexport interface LinkProps extends AnchorAttributes \n```\n**Extends:** AnchorAttributes\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [prefetch?](#) | | boolean \\| 'js' |

_(Optional)_ \\*\\*Defaults to \\_true\\_.\\*\\*

Whether Qwik should prefetch and cache the target page of this \\*\\*Link\\*\\*, this includes invoking any \\*\\*routeLoader$\\*\\*, \\*\\*onGet\\*\\*, etc.

This \\*\\*improves UX performance\\*\\* for client-side (\\*\\*SPA\\*\\*) navigations.

Prefetching occurs when a the Link enters the viewport in production (\\*\\*on:qvisibile\\*\\*), or with \\*\\*mouseover/focus\\*\\* during dev.

Prefetching will not occur if the user has the \\*\\*data saver\\*\\* setting enabled.

Setting this value to \\*\\*"js"\\*\\* will prefetch only javascript bundles required to render this page on the client, \\*\\*false\\*\\* will disable prefetching altogether.

|\n| [reload?](#) | | boolean | _(Optional)_ |\n| [replaceState?](#) | | boolean | _(Optional)_ |\n| [scroll?](#) | | boolean | _(Optional)_ |", "editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/runtime/src/link-component.tsx", "mdFile": "qwik-city.linkprops.md" }, diff --git a/packages/docs/src/routes/api/qwik-city/index.md b/packages/docs/src/routes/api/qwik-city/index.md index 5a6f80c2c23..63e60f766db 100644 --- a/packages/docs/src/routes/api/qwik-city/index.md +++ b/packages/docs/src/routes/api/qwik-city/index.md @@ -4,12 +4,6 @@ title: \@builder.io/qwik-city API Reference # [API](/api) › @builder.io/qwik-city -## "link:app" - -```typescript -'link:app'?: boolean; -``` - ## Action ```typescript @@ -482,13 +476,12 @@ export interface LinkProps extends AnchorAttributes **Extends:** AnchorAttributes -| Property | Modifiers | Type | Description | -| ------------------------------------ | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ["link:app"?](#linkprops-_link_app_) | | boolean | _(Optional)_ | -| [prefetch?](#) | | boolean \| 'js' |

_(Optional)_ \*\*Defaults to \_true\_.\*\*

Whether Qwik should prefetch and cache the target page of this \*\*Link\*\*, this includes invoking any \*\*routeLoader$\*\*, \*\*onGet\*\*, etc.

This \*\*improves UX performance\*\* for client-side (\*\*SPA\*\*) navigations.

Prefetching occurs when a the Link enters the viewport in production (\*\*on:qvisibile\*\*), or with \*\*mouseover/focus\*\* during dev.

Prefetching will not occur if the user has the \*\*data saver\*\* setting enabled.

Setting this value to \*\*"js"\*\* will prefetch only javascript bundles required to render this page on the client, \*\*false\*\* will disable prefetching altogether.

| -| [reload?](#) | | boolean | _(Optional)_ | -| [replaceState?](#) | | boolean | _(Optional)_ | -| [scroll?](#) | | boolean | _(Optional)_ | +| Property | Modifiers | Type | Description | +| ------------------ | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [prefetch?](#) | | boolean \| 'js' |

_(Optional)_ \*\*Defaults to \_true\_.\*\*

Whether Qwik should prefetch and cache the target page of this \*\*Link\*\*, this includes invoking any \*\*routeLoader$\*\*, \*\*onGet\*\*, etc.

This \*\*improves UX performance\*\* for client-side (\*\*SPA\*\*) navigations.

Prefetching occurs when a the Link enters the viewport in production (\*\*on:qvisibile\*\*), or with \*\*mouseover/focus\*\* during dev.

Prefetching will not occur if the user has the \*\*data saver\*\* setting enabled.

Setting this value to \*\*"js"\*\* will prefetch only javascript bundles required to render this page on the client, \*\*false\*\* will disable prefetching altogether.

| +| [reload?](#) | | boolean | _(Optional)_ | +| [replaceState?](#) | | boolean | _(Optional)_ | +| [scroll?](#) | | boolean | _(Optional)_ | [Edit this section](https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/runtime/src/link-component.tsx) diff --git a/packages/qwik-city/runtime/src/api.md b/packages/qwik-city/runtime/src/api.md index a6ce4e5bd7b..3a0d9523383 100644 --- a/packages/qwik-city/runtime/src/api.md +++ b/packages/qwik-city/runtime/src/api.md @@ -261,8 +261,6 @@ export const Link: Component; // // @public (undocumented) export interface LinkProps extends AnchorAttributes { - // (undocumented) - 'link:app'?: boolean; prefetch?: boolean | 'js'; // (undocumented) reload?: boolean; diff --git a/packages/qwik-city/runtime/src/link-component.tsx b/packages/qwik-city/runtime/src/link-component.tsx index 1d52ba5026e..9406e750d80 100644 --- a/packages/qwik-city/runtime/src/link-component.tsx +++ b/packages/qwik-city/runtime/src/link-component.tsx @@ -19,7 +19,6 @@ export const Link = component$((props) => { ...linkProps } = (() => props)(); const clientNavPath = untrack(() => getClientNavPath({ ...linkProps, reload }, loc)); - linkProps['link:app'] = !!clientNavPath; linkProps.href = clientNavPath || originalHref; const prefetchData = untrack( @@ -80,6 +79,8 @@ export const Link = component$((props) => { : undefined; return ( { if (currentPath !== location.pathname + location.search) { // Hook into useNavigate context, if available. // We hijack a here, goes through the loader, resumes, app, etc. Simple. - // TODO Will only work with , is there a better way? Will `q:key` change? + // TODO Will only work with , is there a better way? const container = currentScript!.closest('[q\\:container]')!; - const link = container.querySelector('a[q\\:key="AD_1"]'); + const link = container.querySelector('a[q\\:link]'); if (link) { // Re-acquire container, link may be in a nested container.