Skip to content

Releases: nitedani/zustand-querystring

v0.4.0

22 Nov 14:24

Choose a tag to compare

What's New

  • Standalone mode: Set key: false to use individual query parameters for each state key. Allows multiple stores on the same page without conflicts.

Breaking Changes

  • Readable format changes: The readable format has been updated with breaking changes to the encoding scheme.

v0.3.1

21 Nov 10:42

Choose a tag to compare

v0.3.1

New Features

syncNull and syncUndefined Options

Control how null and undefined values are handled:

querystring(storeInitializer, {
  syncNull: true,      // Sync null values to URL (default: false)
  syncUndefined: true, // Sync undefined values to URL (default: false)
})

Default (backward compatible): null/undefined values are not synced - setting them clears back to initial state

When enabled: null/undefined values persist in URL across refreshes

Changes

  • Only plain objects ({}) are recursively compared - Date, RegExp, Map, Set, and class instances are atomic
  • Added 45+ comprehensive tests
  • Updated documentation with usage examples and behavior clarifications
  • Fixed default key documentation ($'state')

Full Changelog: v0.3.0...v0.3.1

v0.3.0

21 Nov 08:39

Choose a tag to compare

What's New

Human-Readable URL Format

Added an optional readable format for cleaner, more compact query strings:

import * as format from "zustand-querystring/format/readable";

const useStore = create()(
  querystring(
    (set) => ({ count: 0, name: "John" }),
    { format }
  )
);

Before: ?state=%7B%22count%22%3A5%2C%22name%22%3A%22John%22%7D
After: ?state=count:5..name=John

Bug Fixes

  • Fixed double-encoding issue where query parameters were encoded twice

Other Changes

  • Added comprehensive test suite with 50+ edge case tests
  • Updated documentation

Breaking Changes

  • Fixed double-encoding bug. URLs from v0.2.0 will not be compatible and will reset to default state.

0.1.0, new URL encoding

08 Aug 01:33
68a9dac

Choose a tag to compare

0.1.0 is a breaking change.
The URL encoding and decoding is simplified.
Before 0.1.0, zustand-querystring used a proprietary format to encode the state in the URL.
While this made the URL more readable and short, it could cause unexpected issues when other tools/libraries tried to parse it.
In this new version, encoding and decoding is handled by encodeURIComponent and decodeURIComponent. This makes the state in the URL unreadable, but should be more compatible with third-party tools.