Skip to content

Conversation

@ealmloff
Copy link
Member

@ealmloff ealmloff commented Oct 27, 2025

We now have 3-5 different future hooks:

  1. use_resource
  2. use_loader
  3. use_server_future
  4. use_action
  5. use_future

use_resource, use_loader, and use_server_future provide very similar behavior with a different view of the state. This PR is an exploration of merging most of the logic backing at least those three hooks by providing a store-like interface for resources that lets you drill into Options and Results while still maintaining methods on resources like .restart()

  • Make resources mappable in a similar way to stores. You should be able to take Resource<Option<Result<T, E>>> and turn it into Option<Result<Resource<T>, Resource<E>>>
  • Make use_loader an alias for a transposed resource
  • Add more type aliases for different mapped resources and document type aliases
  • Explore use_action as a controlled resource which can be mapped in a similar way
  • Review and minify breaking changes

Stacked on #4838

@ealmloff ealmloff added hooks Changes to built-in hook package experimental May or may not be merged signals Related to the signals crate labels Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental May or may not be merged hooks Changes to built-in hook package signals Related to the signals crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant