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

Reading from already completed resource using .with gets stuck in fallback #1751

Closed
akarras opened this issue Sep 18, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@akarras
Copy link
Contributor

akarras commented Sep 18, 2023

Describe the bug
When reading a resource using .with the resource will load on the initial page load, but navigating between different pages that might use the same resource results in the components getting stuck in the fallback.

Leptos Dependencies

Currently on 2b59ae18

leptos = { git = "https://github.com/leptos-rs/leptos.git", default-features = false, features = [
  "serde",
  "nightly"
] }
leptos_axum = { git = "https://github.com/leptos-rs/leptos.git" }
leptos_router = { git = "https://github.com/leptos-rs/leptos.git", default-features = false }
leptos_meta = { git = "https://github.com/leptos-rs/leptos.git", default-features = false }

To Reproduce
minimal reproduction
Steps to reproduce the behavior:

  1. With the gist provided, serve using cargo-leptos with SSR.
  2. navigate to the other page
  3. observe "Loading" stays.

Expected behavior
Suspense can resolve even if resource is loaded

Additional context
This occurs with create_local_resource or create_resource

@gbj gbj added the bug Something isn't working label Sep 19, 2023
@gbj
Copy link
Collaborator

gbj commented Sep 19, 2023

Thanks! The new Resource::with() has turned out to be the bane of my existence this week, because it behaves quite differently from the old Resource::with() (now named Resource::map()) or from ::get()... namely that it always returns U instead of Some(U), so whether it returns Some or not doesn't indicate whether it's actually loaded or not!

Linked PR fixes this one without breaking either of the other two cases, so I think it should be... getting better slowly?

@akarras
Copy link
Contributor Author

akarras commented Sep 19, 2023

Very nice. Tested my larger project against the branch it looks like things are working.

Now onto pt 4 🤠

@gbj
Copy link
Collaborator

gbj commented Sep 19, 2023

pleeeeeeeeaassee nooooooooooooooo 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants