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

Optimize Cache, Subscription & Pagination Handling - useSubscription.ts #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Cherkaso8
Copy link

This PR introduces optimizations and fixes to the useSubscription.ts file to enhance caching and subscription handling. Here’s a summary of the changes:

1. Consolidation of Types:

  • Removed redundant type definitions for HookOptions and PaginatedHookOptions.

2. Improved Cache Handling:

  • Optimized the useRequestData hook to ensure better handling of stale data when keepStaleData is enabled.

3. Fixed Subscription State Management:

  • Enhanced useSubscription to properly merge and update subscription data in real time, while respecting cache policies.

4. Paginated Request Fix:

  • Updated usePaginatedRequest to handle pagination more effectively by properly managing cache and data fetching.

5. Merged Subscription & Paginated Data:

  • Improved usePaginatedSubscription to ensure that paginated and subscription data are merged correctly, avoiding duplication.

Improvements provide cleaner, more compact and readable code. 

Status updates and demo are minimized, which should speed up the application. 

The code has become easier to test and maintain thanks to an improved structure and more rigorous typing.
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.

1 participant