tinyplex / tinybase

The reactive data store for local‑first apps.
https://tinybase.org
MIT License
3.71k stars 77 forks source link

React UI Hooks don't seem to have "with-schema" variants #112

Closed bndkt closed 11 months ago

bndkt commented 11 months ago

Describe the bug

Sorry for opening two issues in a row 😅

I'm using the /with-schemas' imports to have typed functions based on my Store schema everywhere. I noticed that for the React UI hooks likeimport { useCreatePersister, useCreateStore } from "tinybase/ui-react";` there don't seem to be variants that support typed stores.

So now when I e.g. call useCreatePersister() with my typed Store, the types don't match and I have to do useCreatePersister(typedStore as Store) do avoid TS complaining.

Is this intentional, or did I just overlook something?

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

No response

Expected behavior

Importing from e.g. import { useCreatePersister } from "tinybase/ui-react"; should provide a useCreatePersister function that accepts a typed store (Store<[TablesSchema, ValuesSchema]>) as a parameter.

Screenshots or Videos

No response

Platform

Additional context

No response

bndkt commented 11 months ago

OK scratch that, it's addressed with https://github.com/tinyplex/tinybase/issues/73#issuecomment-1693466344