Skip to content

Conversation

@alanjhughes
Copy link
Contributor

Summary

We'd like to add a new persister to support the next version of expo-sqlite which is a ground up rewrite. The plan would be to deprecate the legacy persister and API once the new api has been available for an SDK cycle or two.

How did you test this change?

Tested in the example project we used for the original persister. Can be seen here

@jamesgpearce
Copy link
Contributor

Once the old one is gone, are you ok with this being called 'next' for ever?

@alanjhughes
Copy link
Contributor Author

It's ok with me but I'll defer to @brentvatne

@alanjhughes alanjhughes force-pushed the @alanhughes/expo-sqlite-next-persister branch from eebdbce to acded9f Compare November 15, 2023 15:36
@jamesgpearce jamesgpearce merged commit 6feda0f into tinyplex:main Nov 16, 2023
@jamesgpearce
Copy link
Contributor

Amazing. Thanks!

@brentvatne
Copy link

ideally we'd remove the next from the name after the old one is gone. this won't be until about april.

@alanjhughes alanjhughes deleted the @alanhughes/expo-sqlite-next-persister branch November 16, 2023 05:48
@tobiascornille
Copy link

tobiascornille commented Jan 2, 2024

@alanjhughes Are you planning on creating a simpler example project without the syncing using CR-SQLite?
I'm asking because I'm running into problems with a simple set up:

db.ts

db.execSync(`CREATE TABLE IF NOT EXISTS test (id PRIMARY KEY, name TEXT);`);

App.tsx

  const store = useCreateStore(createStore);
  useCreatePersister(
    store,
    (store) =>
      createExpoSqliteNextPersister(store, db, {
        mode: "tabular",
        tables: {
          load: {
            test: { tableId: "test", rowIdColumnName: "id" },
          },
          save: {
            test: { tableName: "test", rowIdColumnName: "id" },
          },
        },
      }),
    [db],
    async (persister) => {
      await persister.startAutoLoad();
      await persister.startAutoSave();
    },
  );

  const addData = useCallback(
    () => store.setCell("test", nanoid(10), "name", "testtest"),
    [store],
  );

When addData is called, it is not saved to the SQL database. I also cannot see data I insert using SQL in TinyBase.

If I add console.info to the createExpoSqliteNextPersister I get

 INFO  BEGIN undefined
 INFO  BEGIN undefined
 INFO  BEGIN undefined
 INFO  BEGIN undefined

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.

4 participants