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

expose promises for server side rendering #60

Open
tmjam opened this issue Oct 16, 2019 · 3 comments
Open

expose promises for server side rendering #60

tmjam opened this issue Oct 16, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@tmjam
Copy link

tmjam commented Oct 16, 2019

In order to use this library with server-side rendering techniques other than Nextjs, it needs a way to expose all the promises registered via useQuery so the server-side can await all those promises to resolve before re-rendering the application.

@marcin-piela
Copy link
Owner

Do you use any library for SSR? If so could you provide example in codesandbox? It will help me with finding a way to solve your problem 🙂

@tmjam
Copy link
Author

tmjam commented Oct 16, 2019

Not using one currently, I wanted to use react-fetching-library library and add SSR support built into it. The approach would be similar to this library. https://github.com/simoneb/axios-hooks where it exposes all the promises registered that can be awaited upon.

@marcin-piela marcin-piela added the enhancement New feature or request label Oct 18, 2019
@rlaffers
Copy link

rlaffers commented Aug 25, 2020

@tmjam Does this not work for you?

const { query } = useQuery(action, false);
// elsewhere in your component in an async function:
const response = await query()

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

No branches or pull requests

3 participants