Changelog - 2026-11-08
BrowserStorage.subscribe tells a change of this tab from one of another tab
New FeatureIn one line. The listener of BrowserStorage.subscribe used to be called with nothing, so it could not tell its own write from a change in another tab. It now gets { isExternal }.
ts
import { BrowserStorage } from '@venizia/ardor';
const stop = BrowserStorage.subscribe({
key: '@app/prefs/draft',
listener: ({ isExternal }) => {
if (isExternal) {
console.log('The draft changed in another tab.');
}
},
});
stop();What changed
- Listener receives change origin.
BrowserStorage.subscribenow passes an{ isExternal }object to the listener callback, whereisExternalisfalsefor changes made within the current tab (set,remove,removeWhere) andtruefor updates or clears triggered by another tab. - Distinguish local and remote updates. This lets a listener avoid a write-back loop and respond only to actions that come from other tabs, such as showing a banner when data changes elsewhere.
- Nothing breaks. A listener that takes no argument keeps working as it did.
IStorageChangeis the new exported type of the argument.
Who is affected
- Code that writes from a
BrowserStorage.subscribelistener, or shows "changed in another tab". ReadisExternalto tell the two cases apart. - All other apps. No action needed.
See Browser storage.