Zero 0.26
Schema Backfill and Scalar Subqueries
Installation
npm install @rocicorp/zero@0.26Features
- Schema Backfill: Zero now natively supports adding columns with non-constant defaults, or adding existing columns to a custom publication. There is no longer a need to touch every row in the database to backfill data manually.
- Scalar Subqueries: Added a new optional optimization for
existsqueries that filter by related data with a one-to-one relationship. This can improve query performance significantly for cases where the subquery result changes rarely. - Virtual Scroll: Added zero-virtual library for efficient infinite scrolling in React.
- Support for
timeandtimetzcolumns: Added support fortimeandtimetzcolumns (thanks GRBurst). - Comparing to
undefined: Added a new convenience for comparing toundefined. This is useful for filtering by nullable fields. - zero.delete(): Added a more convenient way to delete all data from the browser's IndexedDB database.
Fixes
- Updating auth tokens no cycles connection
- Add configurable back-pressure limit for change streamer
- Surface replication LSN at /statz?replication
- Generalize all statz output to be machine-readable
- Fix unique constraint violations during sync
- Fix zero-sqlite3 install script to work with bun
- Warn when mutations are rejected due to offline/error/closed state
- Fix queries being dropped when other queries with same hash expire
- Fix incorrect query results when filtering by undefined values
- Fix connection.connect() being ignored when in error/auth state
- Extra table name validation
- Redact sensitive info from logs
- Do not log mutation args
- Allow validation of JWT issuer and audience claims
- Protect against admin password timing attacks
- Forward origin header to API server
- Escape publication names
- Prevent denial of service attacks
- Fix race condition in notification handling
- Fix custom kvStoreProvider being ignored in React Native (thanks @kvnkusch!)
- Allow hybrid permissions with new queries in zero-cache-dev
- Fix unnecessary reconnection attempts after auth errors
- Fix "database connection is not open" error during shutdown
- Fix view-syncer crash from stale WebSocket messages
- Forward fresh auth token with each push message (thanks @jbingen!)
- Prevent IDB collection from deleting active databases
- Fix statz double close and ensure sqlite db handles are closed
- Fix OOM crashes when replicating databases with large rows
- Fix parsing of json[] and jsonb[] types
- Fix slow queries on tables with nullable unique columns
- Fix replication crash from closed WebSocket (thanks @utkarsh-611!)
- Fix notifications not working in background browser tabs
- Log WebSocket close code 1006 as info, not error (thanks @jbingen!)
- Fix replication deadlock on Storer crash (thanks @utkarsh-611!)
- Downgrade IDBNotFoundError to info log level (thanks @jbingen!)
- Fix type safety for default context/schema types
- Fix watermark errors when restoring from litestream backups
- Fix replica metadata being deleted during non-disruptive resync
- Fix occasional server crash when Postgres goes down
- Set idle transaction timeout to prevent hung transactions
- Fix lock errors under high CDC load
- Retry on change-db connection errors
- Detect publication differences during initial sync
- Prevent concurrent schema migrations from racing
- Fix stale destroy timers on query resubscribe (thanks @alpkaravil!)
- Add missing @types/ws dependency (thanks @YevheniiKotyrlo!)
- Fix constraints not detected when definition changes but name stays same
- Fix duplicate mutations when retry transaction succeeds
- Fix analyze-query crash with scalar subqueries
- Detect tables moved out of published schema
Breaking Changes
Just two very minor breaking changes this time, that are unlikely to affect most users:
- If you send custom headers to query or mutate endpoints, you must now allowlist them via
ZERO_MUTATE_ALLOWED_CLIENT_HEADERSorZERO_QUERY_ALLOWED_CLIENT_HEADERS. By default, no client-provided headers are forwarded. - If you have very large mutations, note that WebSocket messages are now limited to 10MB by default. Increase
ZERO_WEBSOCKET_MAX_PAYLOAD_BYTESif needed.