Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation on now to track useStore #6886

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ contributors:
- adamdbradley
- aendel
- jemsco
updated_at: '2023-10-18T07:33:22Z'
- czuma
updated_at: '2024-09-18T02:08:00Z'
created_at: '2023-03-31T02:40:50Z'
---

Expand Down Expand Up @@ -232,6 +233,7 @@ const delay = (time: number) => new Promise((res) => setTimeout(res, time));

> Sometimes it is required to only run code either in the server or in the client. This can be achieved by using the `isServer` and `isBrowser` booleans exported from `@builder.io/qwik/build` as shown above.

> If you want to track `useStore()` objects and execute something when any of their internal values change, use `track(myExampleStore)` directly without the anonymous function. This prevents `track()` from losing the reference to the original reactive object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inaccurate. What this non-function form does is tell track to treat it as a signal/store and subscribe to it. The function form would have to be track(() => Object.keys(store)).

In any case, it still doesn't subscribe to deep changes.


### `track()` as a function

Expand Down