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

WIP upgrade to leptos-0.7 #38

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

Conversation

stefanboere
Copy link

@stefanboere stefanboere commented Dec 5, 2024

Changes:

  • Changed Rc<RefCell<..>> to Arc<Mutex<..>> everywhere to get Sync + Send
  • Added many Send + Sync constraints
  • Removed default_options from QueryOptions since not supported in Resource any more
  • Switched to serde_json and serde over miniserde because leptos has a dependency on serde_json already anyway
  • Undo async trait removal in 'WIP upgrade to leptos-0.7'; It is needed to use this type as trait objects
  • Removed gloo_timers::future::sleep and used futures::future::pending instead as the future returned by gloo_timers::future::sleep is not Sync

Open issues:

  • start-csr is still todo, but running into Send/Sync issues with JsFuture
  • ResourceOption::Local option is still todo, don't know how
  • Bug: The double use of Post 2 only loads the first post from browser cache, don't know why or how to fix
  • 3 tests are still failing or are flakey, don't know why or how to fix
  • The IndexedDb feature cannot be used due to Sync/Send constraints, don't know how to fix

Solved but not sure if solved correctly

  • How the initial query fetch is done now, and how sleep is changed to something with signals, see commit cc04a8f
  • How this should be converted to 0.7
if resource.loading().get_untracked()
     && !HydrationCtx::is_hydrating()
     && query.with_state(|state| matches!(state, QueryState::Created))
{
    query.execute()
}

Any help on these open points would be appreciated :).

rakshith-ravi and others added 2 commits October 15, 2024 19:27
Changes
- Changed Rc<RefCell<..>> to Arc<Mutex<..>> everywhere to get Sync + Send
- Added many Send + Sync constraints
- Removed default_options from QueryOptions since not supported in
  Resource any more
- Switched to serde_json and serde over miniserde because leptos has a
  dependency on serde_json already anyway
- Undo async trait removal in 'WIP upgrade to leptos-0.7';
  It is needed to use this type as trait objects
- Removed gloo_timers::future::sleep and used futures::future::pending
  instead as the future returned by gloo_timers::future::sleep is not
  Sync

Status
- start-axum compiles but keeps saying 'Loading...' unless you do
  prefetch first
- start-csr is still todo
- ResourceOption::Local option is still todo
- I don't know yet how to convert this to 0.7

```
  if resource.loading().get_untracked()
      && !HydrationCtx::is_hydrating()
      && query.with_state(|state| matches!(state, QueryState::Created))
   {
       query.execute()
   }
```
@stefanboere
Copy link
Author

stefanboere commented Dec 31, 2024

I tried to do as much as possible, but running into a few difficult parts where I don't really know how to proceed. See the comments above. So for now I'll stop working on this. And I don't expect to be able to finish this in the future. But I'll leave this PR open so hopefully someone else can give it a try also :).

What works:

  • Leptos_query compiles and base functionality seems to work as long as you use ssr and hydrate.
  • start-axum works mostly
  • leptos-query-axum-workspace works mostly
  • localstorage feature kind of works

What doesn't work (see also comment above)

  • csr
  • Indexed_db feature
  • ResourceOption::Local

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

Successfully merging this pull request may close these issues.

2 participants