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

support atomWithQuery #20

Open
himself65 opened this issue May 11, 2023 · 6 comments
Open

support atomWithQuery #20

himself65 opened this issue May 11, 2023 · 6 comments

Comments

@himself65
Copy link
Member

No description provided.

@dai-shi
Copy link
Member

dai-shi commented May 11, 2023

Is it for "searchParams"?

We have some discussions in #9.
I think atomWithSearch and/or atomWithSearchParam would be nice.

I don't have bandwidth to work on it. Would you or anyone be willing to do?
I think it's better to write an RFC doc first before implementing, because there should be some ideas for API.

@himself65
Copy link
Member Author

I think it's a little different. In next.js, query could be other things. Like /[queryId]/all, the query.queryId is a subpath

@dai-shi
Copy link
Member

dai-shi commented May 11, 2023

I see, location path patterns, I'd say. Maybe, atomWithLocationQuery? Open for ideas.

Same applies 👇

I don't have bandwidth to work on it. Would you or anyone be willing to do? I think it's better to write an RFC doc first before implementing, because there should be some ideas for API.

@lveillard
Copy link

lveillard commented Jul 14, 2023

I'm trying to achieve it this way:
pmndrs/jotai#485 (comment)

@lveillard
Copy link

So I was able to run that one with a useMemo in a component, but not as an atom in a separated file. Importing Router generates too many problems.

For instance even if Router is true, Router.isReady can potentially throw an error...

So I did a workaround by creating a component in the _app.tsx that subscribes to router=useRouter() changes and updates an atom on each change. Then i can use that atom everywhere.

I hope there is a way to add atomWithLocationQuery or atomWithRouter somehow!

@dai-shi
Copy link
Member

dai-shi commented Jul 15, 2023

pmndrs/jotai#485 (comment)

Replied there, but maybe we should continue discussion here? Or open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants