Skip to content

Releases: tinyplex/tinybase

v4.3.7

27 Sep 19:24

Choose a tag to compare

This release adds the PartyKit server constructor to the TypeScript definition files so it can be called from an overriding class.

(v4.3.6 was a PartyKit dependency upgrade)

v4.3.5

23 Sep 22:12

Choose a tag to compare

This updates the PartyKit dependency since they are moving pretty fast right now.

v4.3.4

22 Sep 17:17

Choose a tag to compare

This release fixes an issue with IndexedDB where loading from a non-existent would then make it impossible to load or save from it subsequently.

For completeness, the v4.3.1, v4.3.2 and v4.3.3 releases were all cosmetic (documentation) fixes to v4.3.0.

v4.3

21 Sep 15:12

Choose a tag to compare

We're excited to announce TinyBase 4.3, which provides an integration with PartyKit, a cloud-based collaboration provider. Read the release blog post here.

This integration allows you to enjoy the benefits of both a "local-first" architecture and a "sharing-first" platform. You can have structured data on the client with fast, reactive user experiences, but also benefit from cloud-based persistence and room-based collaboration.

tinybase4 3 diagram

This release includes two new modules:

A TinyBase server implementation on PartyKit can be as simple as this:

import {TinyBasePartyKitServer} 
  from 'tinybase/persisters/persister-partykit-server';

export default class extends TinyBasePartyKitServer {}

On the client, use the familiar Persister API, passing in a reference to a PartyKit socket object that's been configured to connect to your server deployment and named room:

const persister = createPartyKitPersister(
  store,
  new PartySocket({
    host: 'project-name.my-account.partykit.dev',
    room: 'my-partykit-room',
  }),
);
await persister.startAutoSave();
await persister.startAutoLoad();

The load method and (gracefully failing) save method on this Persister use HTTPS to get or set full copies of the Store to the cloud. However, the auto-save and auto-load modes use a websocket to transmit subsequent incremental changes in either direction, making for performant sharing of state between clients.

See and try out this new collaboration functionality in the Todo App v6 (collaboration) demo. This also emphasizes the few changes that need to be made to an existing app to make it instantly collaborative.

Also try out the tinybase-ts-react-partykit template that gets you up and running with a PartyKit-enabled TinyBase app extremely quickly.

PartyKit supports retries for clients that go offline, and so the disconnected user experience is solid, out of the box. Learn more about configuring this behavior here.

Note, however, that this release is not yet a full CRDT implementation: there is no clock synchronization and it is more 'every write wins' than 'last write wins'. However, since the transmitted updates are at single cell (or value) granularity, conflicts are minimized. More resilient replication is planned as this integration matures.

v4.3.0-beta.1

18 Sep 02:23

Choose a tag to compare

v4.3.0-beta.1 Pre-release
Pre-release

This is a quiet first beta release of 4.3.0 that will provide first-party support for PartyKit. There are two new modules, persister-partykit-server and persister-partykit-client, which should both be self-explanatory.

If not, the simple demo here might provide some clues as to how this release will work out.

Please kick the tires!

v4.2.3

14 Sep 21:44

Choose a tag to compare

This adds some key props to the StoreInspector to reduce debug spew in development mode. Also upgrades dependencies but pins Puppeteer.

v4.2.2

11 Sep 18:33

Choose a tag to compare

This release adds the useStartTransactionListener, useWillFinishTransactionListener, and useDidFinishTransactionListener hooks. They should always have been there, but were mysteriously missing.

v4.2.1

09 Sep 17:17

Choose a tag to compare

This fixes a problem where setJson would fire two transactions, and also addresses some breaking changes in the cr-sqlite dependency.

v4.2.0

05 Sep 17:37

Choose a tag to compare

This release adds support for persisting TinyBase to a browser's IndexedDB storage. You'll need to import the new persister-indexed-db module, and call the createIndexedDbPersister function to create the IndexedDB Persister.

The API is the same as for all the other Persister APIs:

const store = createStore()
  .setTable('pets', {fido: {species: 'dog'}})
  .setTable('species', {dog: {price: 5}})
  .setValues({open: true});
const indexedDbPersister = createIndexedDbPersister(store, 'petStore');

await indexedDbPersister.save();
// IndexedDB ->
//   database petStore:
//     objectStore t:
//       object 0:
//         k: "pets"
//         v: {fido: {species: dog}}
//       object 1:
//         k: "species"
//         v: {dog: {price: 5}}
//     objectStore v:
//       object 0:
//         k: "open"
//         v: true

indexedDbPersister.destroy();
image

Note that it is not possible to reactively detect changes to a browser's IndexedDB storage. A polling technique is used to load underlying changes if you choose to 'autoLoad' your data into TinyBase.

This release also upgrades Prettier to v3.0 which has a peer-dependency impact on the tools module. Please report any issues!

v4.1.4

01 Sep 13:16

Choose a tag to compare

This allows Prettier v3+ to be present as a peer dependency for tools codegen (even though TinyBase uses Prettier v2.8.8 itself as a dev dependency)