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

Update docs content #2508

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft

Conversation

dbritto-dev
Copy link
Collaborator

Summary

Updating docs content

Check List

  • yarn run prettier for formatting code and docs

Copy link

vercel bot commented Apr 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zustand-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2024 8:37pm

Copy link

codesandbox-ci bot commented Apr 24, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@dbritto-dev
Copy link
Collaborator Author

@charkour @dai-shi @sewera would you mind reviewing the docs under reference and tell me your thoughts?

`createStore` returns a vanilla store with some API utilities. These API utilities are: `setState`
function, `getState` function, and `subscribe` function.

### `setState` function
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like such functions like setState should be in one place, with hyperlinks to them from, e.g., combine function to avoid copying.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sewera that's not supported with the current setup but when we migrate to vitepress we can move everything in one place and then just import them

@dai-shi dai-shi mentioned this pull request May 22, 2024
15 tasks
@dbritto-dev
Copy link
Collaborator Author

@dai-shi lmk what you think about reference section and documentation, still working on usage and troubleshooting section but apart from that everything else should be done on reference section

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

Reviewed the reference docs.

Comment on lines 39 to 40
[`getState` function](#getstate-function) and [`storeApi`](#storeapi) as arguments. It should
return an additional state based on the initial state.
Copy link
Member

Choose a reason for hiding this comment

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

Do we have those for combine?


#### Returns

`combine` returns a new state that is the result of merging the initial state and the additional
Copy link
Member

Choose a reason for hiding this comment

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

More precisely, combine and any other middleware "returns" a state creator.

docs/reference/create-context.md Outdated Show resolved Hide resolved
Comment on lines +76 to +77
The `getState` function lets you access to the current state. It can be stale on asynchronous
operations.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if "stale on async operations" is technically correct.

docs/reference/create-with-equality-fn.md Outdated Show resolved Hide resolved
docs/reference/create-with-equality-fn.md Outdated Show resolved Hide resolved
### `combine` Signature

```ts
combine<T, U>(initialState: T, additionalStateCreator: StateCreator<T, [], [], U>): Omit<T, keyof U> & U
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we clarify where we can import this from? combine is from zustand/middleware.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's a usage section where we can put it

docs/reference/create.md Outdated Show resolved Hide resolved
docs/reference/shallow.md Outdated Show resolved Hide resolved
docs/reference/use-shallow.md Outdated Show resolved Hide resolved
@dbritto-dev
Copy link
Collaborator Author

@dai-shi thanks, working on that

@dai-shi
Copy link
Member

dai-shi commented Jun 2, 2024

Also resolve conflicts please so that we can run CI.

@dbritto-dev
Copy link
Collaborator Author

Also resolve conflicts please so that we can run CI.

Sure

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants