Skip to content

Implement SWR in hook function #700

@acasazza

Description

@acasazza

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

Implement a reusable custom React hook that uses SWR for data fetching so components no longer call useSWR directly. The hook should:

  • Accept a typed key (for example a URL or tuple) and any required parameters for the fetcher.
  • Encapsulate the useSWR configuration (fetcher function, options like revalidateOnFocus, error retry behavior, and cache settings) to standardize behavior across the app.
  • Return a consistent, typed interface (e.g. { data, isLoading, error, mutate }) that can be reused by feature-specific hooks such as useUser, useProject, etc.
  • Live in a shared hooks module so it can be imported and wrapped by domain-specific hooks, keeping components lean and improving testability.

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions