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

SSR - Weird issue with 'loading' #137

Closed
niicojs opened this issue Nov 10, 2019 · 4 comments
Closed

SSR - Weird issue with 'loading' #137

niicojs opened this issue Nov 10, 2019 · 4 comments

Comments

@niicojs
Copy link

niicojs commented Nov 10, 2019

Describe the bug
Server side, I'm getting loading === true even if I'm not firing any request.
I tried putting { onMount: false, loading: false }.

Expected behavior
Loading should be false if no request is made. Moreover, it seems the lib does not do anything server side, so loading should be ever set.

@alex-cory
Copy link
Collaborator

Currently, it doesn't make any requests when on the server. This feature has not been implemented yet which is why loading is set to true by default. Many times people try to iterate over data that may or may not be available yet due to a loading state. i.e.

loading = true
fetch the data
loading = false
if (!loading) display data <- would error here because there's no data

Currently we don't have the fetch request get executed until it is on the client.

@niicojs
Copy link
Author

niicojs commented Nov 10, 2019

In my case, I'm handling a "save" button using use-http. So I have a save button with disabled = saving.
saving beeing the loading state of the post request. Right now, server side, it's rendering a disabled button which shouldn't happend.

@alex-cory
Copy link
Collaborator

Okay, I will change this

@alex-cory
Copy link
Collaborator

This should be fixed. See v0.1.96. If the issue persists, let me know and I'll have another look.

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

2 participants