Skip to content

Commit

Permalink
docs: show-updated-docs (#5516)
Browse files Browse the repository at this point in the history
* add created/updated date to docs frontmatter

* read the frontmatter (#1)

* feat: show updated docs

showing the updated docs with a circle next to the title, in this commit I added the circles.

* chore(docs): remove warnings (#5345)

* style(eslint): convey a stricter restriction from `just` to `only` (examples) (#5340)

* feat(vite): allow disabling dev SSR server in vite (#5347)

* chore(docs): Small fix of file to edit (#5348)

* docs: Update index.mdx (#5351)

* Update index.mdx

Correct mistake. The original was:

Both pages are created by adding ...

Changed to:

 Pages are created by adding ...

* trigger GH checks

---------

Co-authored-by: gioboa <giorgiob.boa@gmail.com>

* fix: action redirect accidentally stripped searchparams (#5349)

Fix #5342

* fix: remove cf pages stream polyfill (#5352)

* chore: updated twitter logo to X (#5357)

* docs: update React cheat sheet title (#5358)

* 1.2.15 (#5359)

* docs: improve SEO with descriptions (#5360)

* fix(cli): parseTemplatePath doesn't work in windows (#5339)

* fix(cli) parseTemplatePath doesn't work in windows

* refactor use path.sep

---------

Co-authored-by: Yale <yale.yu@kuka.com>

* docs: fix typo (#5361)

* chore(qwik-insights): use clientOutDir if provided (#5366)

* docs: remove soundy.cloud (#5374)

* chore: clean up release script (#5376)

* fix(qwik): Incorrect module reference in inlinedQrl (#5375)

* fix(qwik): Incorrect module reference in inlinedQrl

Fix #5368

* fixup! fix(qwik): Incorrect module reference in inlinedQrl

* docs: Alex Russell Approved javascript framework (#5364)

* docs: Alex Russell Approved

Alex Russell Approved JavaScript framework

* docs(faq): wording

* chore: improved README.md for build artifacts (#5377)

* fix(qwik-city): parseBody should not clone Request (#5353)

fix(qwik-city): parseBody should not clone requests

* docs(eslint-rules): refactor use-method-usage to reflect current qwik… (#5344)

* docs(eslint-rules): refactor use-method-usage to reflect current qwik API

* refactored unit tests

* re-add TSAsExpression

* word change: just -> only, to reflect latest PR

---------

Co-authored-by: Miško Hevery <misko@hevery.com>

* fix: Yarn 3/4 PnP compatibility (#5042)

* CI

* revert

---------

Co-authored-by: Roman Zanettin <roman.zanettin@gmail.com>

* Revert "refactor(optimizer): remove using resolvePackageData API from Vite" (#5379)

Revert "refactor(optimizer): remove using resolvePackageData API from Vite (#5312)"

This reverts commit ec53ef7.

* docs: update Alex Russell (#5381)

* chore: 1.2.16 (#5382)

* fix(labs): Better handling and visibility of q-insights.json (#5384)

* feat(insights): Add new route visibility (#5385)

* fix(vite): resolution of nested dependencies

Co-authored-by: Manu MA <manucorporat@users.noreply.github.com>

* docs: fix incorrect escaping in URL (#5387)

* fix(insights): improve files per cluster (#5388)

Increase clustering distance which should result in creation of fewer clusters.
Fewer clusters means that less files should be downloaded to the client
(each file will have more symbols.) This should improve performance.

* fix(qwik): Improve logging of vite plugin (#5389)

fix(qwik): Improve logging of vite plugin

The log now includes file location and code snippet.

* fix(core): parent component lookup during pause

the parentCtx attribute was optimized to point directly to parents with
$contexts$ defined, but that broke pausing which needs the immediate parent.

Co-authored-by: Jesse Zhang <jesse.zhang@orchard.com>

* chore: clean up docs site build warnings (#5391)

* docs: explain custom event props and detail when PropFunction is needed (#5386)

* docs: don't index demos; don't duplicate meta descriptions (#5392)

* docs: add custom 404 page (#5393)

* chore(docs): small improvements to routing/index.mdx

* refactor(package.json): add docs.dev & docs.preview

Add pnpm docs.dev & pnpm docs.preview commands to improve the DX for contributors.

* chore: 1.2.17 (#5397)

* fix(insight): use relative path (#5399)

* docs: Update media page with new YouTube video links (#5401)

Update media page with new YouTube video links

* chore(starters): add VSCode debug setting (#5408)

* docs(integrations): astro integration docs (#5409)

* docs(integrations): astro integration docs

* docs(integration): typo

* docs(docs): updated docs changes

* docs(menu): Add Astro integration to menu (#5410)

* Add Astro integration to menu

* Add description and keywords to Astro integration
page, and update contributor list.

* chore(docs): update node integration page (#5413)

Bold statement regarding `ORIGIN` env var.

* fix(qwik-city): vercel adapter default to `webworker` target (#5414)

* docs: correct broken image (#5415)

* docs(astro): Qwik + Astro doc improvements (#5416)

* Qwik astro doc improvements

* typo fix

* fix(propfunctionprops): prevent 'undefined', 'null', 'never' conversion to PropFnInterface (#5363)

* fix(propfunctionprops): prevent 'undefined', 'null', 'never' conversion to PropFnInterface

fix #4946

* improve PropFunctionProps readability and edge-cases

* fix never becoming undefined

* fixup! fix never becoming undefined

* refine tests

---------

Co-authored-by: Miško Hevery <misko@hevery.com>

* fix(qwik-city): better type for svg?jsx imports (#5420)

* fix(qwik-city): fix rendered svg?jsx component closing tag (#5423)

* fix: fix optimized svg closing tag

* test: add svg optimizer test

* fix: cache max-age vite.config for dev mode (#5427)

* fix(cli): casing for component and mdx route creation (#5430)

* docs: fix broken image (#5432)

* docs: fixed small typo (#5434)

* docs: add missing contributors (#5435)

* fix: 3rd party imports of libs during build (#5431)

Co-authored-by: Miško Hevery <misko@hevery.com>

* fix(docs): improve SEO  (#5439)

* feat(core): auto px addition to css properties for unitless numbers (#5426)

* feat(core): auto px addition to css properties for unitless numbers

This adds support for auto-addition of 'px' to css properties

* add tests to check styles in both ssr and csr

* docs: Add link to create new Qwik Insights app as self-serve (#5443)

* fix: Pass the missing props for Spinner component (#5437)

Pass the missing props for Spinner component

As the `growing` props is missing in the bootstrap starter template `Spinner` component it is causing the issue in production build while testing after adding the bootstrap.

* fix(docs): Wrap function in cleanup function instead of returning it (#5440)

Wrap function in cleanup function instead of returning it

* fix(docs): typo in qwikcity -> Validator docs (#5444)

---------

Co-authored-by: gioboa <giorgiob.boa@gmail.com>

* fix(docs): typo in qwik city -> middleware page (#5446)

---------

Co-authored-by: gioboa <giorgiob.boa@gmail.com>

* fix(docs): update links for Edit this page button (#5445)

---------

Co-authored-by: gioboa <giorgiob.boa@gmail.com>

* chore: 1.2.18 (#5449)

* docs: Add Component library `ionic-qwik` to community projects on docs. (#5429)

Add Component library `ionic-qwik`.

* chore(docs): advanced usage of Slot, visibleTask (#5424)

chore(docs): advanced Slot, visibleTask, Context

* chore(core): update `QwikKeyboardEvent` type (#5433)

chore(core): update keyboardevent to have code attr and update deprecated attrs

* fix(docs): remove `inline-code` and `link` in tag `<a />` (#5450)

---------

Co-authored-by: wangyipeng <ffwangyipeng@chinatelecom.cn>
Co-authored-by: Giorgio Boa <35845425+gioboa@users.noreply.github.com>

* docs(ssg): fix shell command (#5459)

* docs(auth.js): add credentials example (#5462)

* chore: 1.2.19 (#5466)

* chore(all): Vite 5 upgrade

* chore(core): remove resolvePackageData (#5312)

* chore: pnpm api.update

* feat(playground): remove broken versions

* feat: add qwik/no-use-visible-task eslint rule (#5455)

* feat: add qwik/no-use-visible-task eslint rule
----
Co-authored-by: Matteo Pietro Dazzi <ilteoood@users.noreply.github.com>
Co-authored-by: Pasquale De Lucia <pasquale.delucia96@gmail.com>
Co-authored-by: Gloria Giannascoli <gloriag-dev@users.noreply.github.com>
Co-authored-by: pietrodev07 <pietrodev07@users.noreply.github.com>

* linter 🧽

* feat: add extra tips

* fix: change message

* docs: add missing eslint recap

* chore(insights): remove unnecessary log (#5461)

* fix: add example context to docs (#5467)

* feat(qwik-city): allow customizing SVGO options of image plugin (#5407)

* docs: fix typo

* docs: fix typo (#5481)

* fix(core): Support JSX in signals (#5442)

Fix #4966
Fix #3530

* docs(FAQ): - lazy-loading on user interaction & speculative module fetching (#5488)

docs: FAQ - lazy-loading on user interaction & speculative module fetching

* docs(faq): add link to typescript (#5487)

* fix: disable Vite modulepreload (#5493)

* fix: disable Vite modulePreload

Fixed: #5478

* chore: use cleaner option

* docs(faq): fix typos and improve the wording of some sentences (#5490)

* docs: make the distinction between module-prefetching and <Link prefetch> (#5485)

docs(module-prefetching): make the distinction between module-prefetching and <Link prefetch>

* docs(showcase): add `index.app` and `wiza.co` (#5484)

Update pages.json

* fix(docs): mdx interpreting title as component (#5499)

* docs: cleanup the vdom section (#5500)

* fix: revert "fix: remove cf pages stream polyfill" (#5502)

* fix(qwik-city): prefix ids of SVGs based on their path when loaded as qwik nodes (#5497)

Enable the prefixIds SVGO plugin by default, while still allowing customization. This is a follow up
on #5407. Here's a discussion on why it makes sense when
optimizing SVG files for the web: svg/svgo#674.

* fix: cf pages polyfill only if needed (#5507)

fix: polyfill only if needed

* refactor: extract group type

* docs: add QwikCityMockProvider explanation (#5505)

* Extend index.mdx to include QwikCityMockProvider

* docs: add links between vitest integration page and qwikcity api page

* docs(glob-import): add documentation for import.meta.glob (#5504)

* docs(glob-import): add documentation for import.meta.glob

* docs(glob-imports): add Glob Import link to /cookbook/index.mdx

* docs(glob-import): refactor type any to Record<string, any>

* docs: add Record<string, any> to mdx as well

* fix: CF pages polyfill also when shimmed (#5512)

* fix: polyfill also when shimmed

* chore: add comment to explain polyfill

* chore: Giorgio's feedback

* refactor: made the renderUpdate as a const

put the mardown update in a const which made the code cleaner and better to understand

* fix: fixed build

* docs: api update

* refactor: build

* chore: fix pnpm-locke file

* chore: build

* chore: pnpm fmt

* refactor: removed style-system

---------

Co-authored-by: Marcos Perona <mperona@gmail.com>
Co-authored-by: Giorgio Boa <35845425+gioboa@users.noreply.github.com>
Co-authored-by: Alex Tocar <commit@ueuie.dev>
Co-authored-by: Miško Hevery <misko@hevery.com>
Co-authored-by: Nelson Sousa <nelsonprsousa@gmail.com>
Co-authored-by: Runar Jordahl <runar.jordahl@gmail.com>
Co-authored-by: gioboa <giorgiob.boa@gmail.com>
Co-authored-by: Kaushik080 <120493528+Kaushik080@users.noreply.github.com>
Co-authored-by: Yoav Ganbar <hamatoyogi@users.noreply.github.com>
Co-authored-by: yale.yu <35560398+yuyidegit@users.noreply.github.com>
Co-authored-by: Yale <yale.yu@kuka.com>
Co-authored-by: Bonny87 <36232591+mBonny87@users.noreply.github.com>
Co-authored-by: D <intellix@users.noreply.github.com>
Co-authored-by: PatrickJS <github@patrickjs.com>
Co-authored-by: Maïeul <45822175+maiieul@users.noreply.github.com>
Co-authored-by: Ian Létourneau <letourneau.ian@gmail.com>
Co-authored-by: Roman Zanettin <roman.zanettin@gmail.com>
Co-authored-by: Wout Mertens <Wout.Mertens@gmail.com>
Co-authored-by: Manu MA <manucorporat@users.noreply.github.com>
Co-authored-by: Jesse Zhang <jesse.zhang@orchard.com>
Co-authored-by: maieulchevalier <maieul.chevalier@gmail.com>
Co-authored-by: Jack Shelton <104264123+thejackshelton@users.noreply.github.com>
Co-authored-by: Erik Eng <e.ptz0n@gmail.com>
Co-authored-by: Steve Sewell <steve@builder.io>
Co-authored-by: Riccardo Perra <perrariccardo0@gmail.com>
Co-authored-by: Pasquale De Lucia <pasquale.delucia96@gmail.com>
Co-authored-by: Sidharth Mohanty <sidmohanty11@gmail.com>
Co-authored-by: Daniela Bonvini <danbonvini@gmail.com>
Co-authored-by: Shai Reznik <shairez@users.noreply.github.com>
Co-authored-by: Lucas Stahl <30933416+Stahlwalker@users.noreply.github.com>
Co-authored-by: John Prem Kumar S <36818969+JohnPremKumar@users.noreply.github.com>
Co-authored-by: Thomas Deinhamer <184284+thasmo@users.noreply.github.com>
Co-authored-by: Harish Krishnan <harishkrishnan1993@gmail.com>
Co-authored-by: Juer Genie Whang <2695996944@qq.com>
Co-authored-by: Juer Genie Whang <juergenie@qq.com>
Co-authored-by: wangyipeng <ffwangyipeng@chinatelecom.cn>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Arjun <arjunsingh8112@gmail.com>
Co-authored-by: Bendegúz Hajnal <hajnalbendeguz@gmail.com>
Co-authored-by: ulic75 <ulic75@gmail.com>
Co-authored-by: Youssef Adbib <mradbib@gmail.com>
Co-authored-by: Necati <necatifk07@gmail.com>
Co-authored-by: Leo <wtlin1228@gmail.com>
Co-authored-by: mulztob <49060581+mulztob@users.noreply.github.com>
  • Loading branch information
Show file tree
Hide file tree
Showing 154 changed files with 2,369 additions and 1,393 deletions.
33 changes: 31 additions & 2 deletions packages/docs/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';
import matter from 'gray-matter';
import { loadEnv } from 'vite';

const rootDir = path.join(path.dirname(url.fileURLToPath(import.meta.url)), '..', '..');
export const PRIVATE_GITHUB_ACCESS_TOKEN =
process.env.GITHUB_TOKEN || loadEnv('', '.', 'PRIVATE').PRIVATE_GITHUB_ACCESS_TOKEN;

async function updateContributors() {
const routesDir = path.join(rootDir, 'packages', 'docs', 'src', 'routes');
Expand Down Expand Up @@ -37,7 +40,17 @@ async function updateGithubCommits(filePath: string) {
url.searchParams.set('since', new Date('2022-01-01').toISOString());
url.searchParams.set('path', repoPath);

const response = await fetch(url.href);
const response = await fetch(url.href, {
headers: {
'User-Agent': 'Qwik Workshop',
'X-GitHub-Api-Version': '2022-11-28',
...(PRIVATE_GITHUB_ACCESS_TOKEN
? {
Authorization: 'Bearer ' + PRIVATE_GITHUB_ACCESS_TOKEN,
}
: {}),
},
});
if (response.status !== 200) {
console.log('error', response.status, response.statusText, await response.text());
await new Promise((resolve) => setTimeout(resolve, 5000));
Expand All @@ -63,6 +76,14 @@ async function updateGithubCommits(filePath: string) {
contributors.push({ author, count: 1 });
}
}

if (commits.indexOf(commit) === 0) {
gm.data.updated_at = commit?.commit?.author?.date;
}

if (commits.indexOf(commit) === commits.length - 1) {
gm.data.created_at = commit?.commit?.author?.date;
}
}

contributors.sort((a, b) => {
Expand All @@ -88,7 +109,15 @@ async function updateGithubCommits(filePath: string) {

console.log(repoPath, contributors.length);

await new Promise((resolve) => setTimeout(resolve, 1000));
if (response.headers.get('x-ratelimit-remaining') === '0') {
const resetHeader = response.headers.get('x-ratelimit-reset');
const resetTime = resetHeader ? parseInt(resetHeader) * 1000 : Date.now() + 1000;
const waitTime = resetTime - Date.now();
console.log(
`next request is rate limited, waiting ${Math.round(waitTime / 1000 / 60)} minutes`
);
await new Promise((resolve) => setTimeout(resolve, waitTime));
}
}

updateContributors();
9 changes: 9 additions & 0 deletions packages/docs/src/components/sidebar/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ details li a {
background-color: #b1b1b13a;
}

.updated {
background-color: var(--interactive-text-color);
width: 6px;
height: 6px;
border-radius: 50%;
margin-top: 0.2rem;
margin-left: 0.3rem;
}

@media (max-width: 1023px) {
.breadcrumbs button {
@apply p-2;
Expand Down
74 changes: 70 additions & 4 deletions packages/docs/src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,70 @@
import { component$, useContext, useStyles$ } from '@builder.io/qwik';
import { type ContentMenu, useContent, useLocation } from '@builder.io/qwik-city';
import { type ContentMenu, useContent, useLocation, routeLoader$ } from '@builder.io/qwik-city';
import { GlobalStore } from '../../context';
import { CloseIcon } from '../svgs/close-icon';
import styles from './sidebar.css?inline';

export const useMarkdownItems = routeLoader$(async () => {
const rawData = await Promise.all(
Object.entries(import.meta.glob<{ frontmatter?: MDX }>('../../routes/**/*.{md,mdx}')).map(
async ([k, v]) => {
return [
k
.replace('../../routes', '')
.replace('(qwikcity)/', '')
.replace('(qwik)/', '')
.replaceAll(/([()])/g, '')
.replace('index.mdx', '')
.replace('index.md', ''),
await v(),
] as const;
}
)
);
const markdownItems: MarkdownItems = {};
rawData.map(([k, v]) => {
if (v.frontmatter?.updated_at) {
markdownItems[k] = {
title: v.frontmatter.title,
contributors: v.frontmatter.contributors,
created_at: v.frontmatter.created_at,
updated_at: v.frontmatter.updated_at,
};
}
});

return markdownItems;
});

type MarkdownItems = Record<string, MDX>;
type MDX = {
title: string;
contributors: string[];
created_at: string;
updated_at: string;
};

const DAYS = 24 * 60 * 60 * 1000;

const renderUpdated = (itemHref: string, markdownItems: MarkdownItems) => {
const updatedAt = markdownItems[itemHref]?.updated_at;

if (updatedAt) {
const isUpdated = new Date(updatedAt).getTime() + 14 * DAYS > new Date().getTime();

return isUpdated ? <div class="updated"></div> : null;
}

return null;
};

export const SideBar = component$((props: { allOpen?: boolean }) => {
useStyles$(styles);

const globalStore = useContext(GlobalStore);
const { menu } = useContent();
const { url } = useLocation();
const markdownItems = useMarkdownItems();
const allOpen = url.pathname.startsWith('/qwikcity/') || props.allOpen;

return (
Expand All @@ -22,7 +77,12 @@ export const SideBar = component$((props: { allOpen?: boolean }) => {
>
<CloseIcon width={24} height={24} />
</button>
<Items items={menu?.items} pathname={url.pathname} allOpen={allOpen} />
<Items
items={menu?.items}
pathname={url.pathname}
allOpen={allOpen}
markdownItems={markdownItems.value}
/>
</nav>
</aside>
);
Expand All @@ -32,10 +92,12 @@ export function Items({
items,
pathname,
allOpen,
markdownItems,
}: {
items?: ContentMenu[];
pathname: string;
allOpen?: boolean;
markdownItems: MarkdownItems;
}) {
return (
<ul>
Expand All @@ -49,16 +111,20 @@ export function Items({
<summary>
<h5>{item.text}</h5>
</summary>
<Items items={item.items} pathname={pathname} />
<Items items={item.items} pathname={pathname} markdownItems={markdownItems} />
</details>
) : (
<a
href={item.href}
class={{
'is-active': pathname === item.href,
}}
style={{ display: 'flex' }}
>
{item.text}
<>
{item.text}
{renderUpdated(item.href!, markdownItems)}
</>
</a>
)}
</li>
Expand Down
8 changes: 8 additions & 0 deletions packages/docs/src/routes/community/groups/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ contributors:
- manucorporat
- cunzaizhuyi
- the-r3aper7
- ayoub9494
- mrhoodz
- Marcoo09
- apherio
- salamaashoush
- adamdbradley
updated_at: '2023-10-15T10:09:17Z'
created_at: '2023-02-03T20:09:34Z'
---
import ImgDiscord from '~/media/ecosystem/discord.svg?jsx';
import ImgQwikNewsletter from '~/media/ecosystem/qwik-newsletter.svg?jsx';
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/src/routes/community/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { OnThisPage } from '../../components/on-this-page/on-this-page';
import { ContentNav } from '../../components/content-nav/content-nav';
import styles from '../docs/docs.css?inline';

// eslint-disable-next-line
export { useMarkdownItems } from '../../components/sidebar/sidebar';

export default component$(() => {
useStyles$(styles);

Expand Down
5 changes: 5 additions & 0 deletions packages/docs/src/routes/community/projects/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ contributors:
- manucorporat
- fabian-hiller
- xinnks
- mrhoodz
- meeroslav
- adamdbradley
updated_at: '2023-08-24T16:15:35Z'
created_at: '2023-02-03T20:09:34Z'
---

# Community Projects
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/src/routes/community/values/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ title: Values | Qwik Community
contributors:
- shairez
- cunzaizhuyi
- mrhoodz
updated_at: '2023-06-25T19:43:33Z'
created_at: '2023-02-03T20:09:34Z'
---

## Qwik Community Values:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ contributors:
- cunzaizhuyi
- Craiqser
- mhevery
- bab2683
- mrhoodz
updated_at: '2023-08-23T23:06:42Z'
created_at: '2023-03-20T23:45:13Z'
---

# Containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ contributors:
- adamdbradley
- the-r3aper7
- mhevery
- mrhoodz
- thejackshelton
updated_at: '2023-06-25T19:43:33Z'
created_at: '2023-03-20T23:45:13Z'
---

# Custom Build Output Directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ contributors:
- mhevery
- AnthonyPAlicea
- zanettin
- mrhoodz
- thejackshelton
- hamatoyogi
updated_at: '2023-06-25T19:43:33Z'
created_at: '2023-03-20T23:45:13Z'
---

# The dollar `$` sign
Expand Down
41 changes: 21 additions & 20 deletions packages/docs/src/routes/docs/(qwik)/advanced/eslint/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
---
contributors:
- zanettin
- hbendev
- manucorporat
- gioboa
- maiieul
updated_at: '2023-11-22T07:02:07Z'
created_at: '2023-05-20T00:04:28Z'
---

[//]: <> (--------------------------------------)
[//]: <> (......THIS FILE IS AUTOGENERATED......)
Expand Down Expand Up @@ -295,11 +305,12 @@ import './styles.css';
</span>
</div>
</a>


<a href="#no-use-visible-task" class="p-4 flex panel">
<div class="flex-1">
<code>no-use-visible-task</code>
<span class="rule-description">Warning for "useVisibleTask$" usage, because Qwik tries very hard to defer client code execution for as long as possible.</span>
<span class="rule-description">Detect useVisibleTask$() functions.</span>
</div>
<div class="flex gap-2 items-center">
<span
Expand All @@ -312,8 +323,8 @@ import './styles.css';
</span>
<span
class={{
'icon': false,
'icon icon-inactive': true,
'icon': true,
'icon icon-inactive': false,
}}
>
🔔
Expand Down Expand Up @@ -356,7 +367,7 @@ export const Counter = (() => {
const count = useSignal(0);
});
```
<p class="code-description">`use*` methods can just be used in `component$` functions or inside `use*` hooks (e.g. `useCounter`).</p>
<p class="code-description">`use*` methods can only be used in `component$` functions or inside `use*` hooks (e.g. `useCounter`).</p>
</div>
<div class="edit-examples-wrapper"><a href="https://github.com/BuilderIO/qwik/edit/main/packages/eslint-plugin-qwik/src/useMethodUsage.ts" target="_blank" class="edit-btn">Edit examples</a></div>

Expand Down Expand Up @@ -1064,25 +1075,15 @@ import Image from '~/media/image.png';
<div class="edit-examples-wrapper"><a href="https://github.com/BuilderIO/qwik/edit/main/packages/eslint-plugin-qwik/src/jsxA.ts" target="_blank" class="edit-btn">Edit examples</a></div>

</div>


<div class="rule-wrapper">
<h3 id="no-use-visible-task">no-use-visible-task</h3>
<span>Qwik tries very hard to defer client code execution for as long as possible. </span>
<span>This is done to give the end-user the best possible user experience. </span>
<span>Running code eagerly blocks the main thread, which prevents the user from interacting until the task is finished.
"useVisibleTask$" is provided as an escape hatch.</span>
<div>When in doubt, instead of "useVisibleTask$()" use:</div>
<ul>
<li>useTask$ -> perform code execution in SSR mode.</li>
<li>useOn() -> listen to events on the root element of the current component.</li>
<li>useOnWindow() -> listen to events on the window object.</li>
<li>useOnDocument() -> listen to events on the document object.</li>
</ul>
<div>Sometimes it is the only way to achieve the result.</div>
<div>In that case, add:</div>
<div>// eslint-disable-next-line qwik/no-use-visible-task</div>
<div>to the line before "useVisibleTask$" to acknowledge you understand.</div>
<div class="edit-examples-wrapper"><a href="https://github.com/BuilderIO/qwik/edit/main/packages/eslint-plugin-qwik/src/noUseVisibleTask.ts" target="_blank" class="edit-btn">Edit examples</a></div>
<span>Detect useVisibleTask$() functions.</span>

<h4>noUseVisibleTask</h4>
<div class="edit-examples-wrapper"><a href="https://github.com/BuilderIO/qwik/edit/main/packages/eslint-plugin-qwik/src/noUseVisibleTask.ts" target="_blank" class="edit-btn">Edit examples</a></div>

</div>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title: Component library | Advanced
contributors:
- manucorporat
- mrhoodz
- thejackshelton
updated_at: '2023-06-25T19:43:33Z'
created_at: '2023-04-26T16:12:18Z'
---

# Library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ contributors:
- saikatdas0790
- the-r3aper7
- mhevery
- mrhoodz
- thejackshelton
- maiieul
updated_at: '2023-06-25T19:43:33Z'
created_at: '2023-03-20T23:45:13Z'
---

# Prefetching modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ contributors:
- manucorporat
- adamdbradley
- mhevery
- mrhoodz
- thejackshelton
- wtlin1228
updated_at: '2023-06-25T19:43:33Z'
created_at: '2023-03-20T23:45:13Z'
---

# Optimizer
Expand Down

0 comments on commit 7868054

Please sign in to comment.