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

Observable client cache #341

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jcblw
Copy link
Contributor

@jcblw jcblw commented Jan 23, 2023

Description

This pull request adds Observable queries to Finch. This does several things for the applications using Finch.

  • Avoid React 18 double fetching
    This is because instead of creating a new fetch, we attach it to the one we have already created, and it does not use useEffect.
  • Reduces memory usage in applications.
    This is because instead of storing data in react state and finches cache. Now React reads directly from the cache using useSyncExternalStore.
  • Makes it easier to integrate other rendering libraries
    A lot of non-react rendering libraries (Solid, Vue, etc) use observables as a primitive. This just makes it easier to use Finch in those environments.

Testing

  • Includes test.
  • Manually tested.

Additional notes

No additional information is given

jcblw added 3 commits January 23, 2023 11:02
* turn each query into an observable

* hook up observable and to react client

* trigger workflow

* get tests working, and add awaited type

* fix some of the types, with the data

* add in cache policy

* move types to root of client package

* fix some test and properly resolve query promise

* add in fetch first policy to the refetch

* add in test for invalidation, and fix the issue with invalidation and lifecycle subscriptions

* rename master to main
… is already in flight (#2)

* update cache loading to allow for removing double fetchs when request is already in flight

* add in update to test to accommodate caching
@jcblw jcblw changed the title Feature/observable queries Observable client cache Jan 23, 2023
@jcblw
Copy link
Contributor Author

jcblw commented Feb 15, 2023

@mikeyamato @zeckdude let me know if y'all are able to look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant