localForage / localForage/localForage

Add support for read/write transactions

Open
#582 0 comments 9 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
25.8k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I've noticed through my use of the library that it's currently not possible to safely perform transactions that require fetching the data in IndexedDB before writing in applications where multiple tabs/windows can be open at the same time. Calling getItem followed by setItem causes race conditions in multi-tab environments due to getItem and setItem each being distinct IndexedDB transactions.

The library would be considerably more useful for managing things like cross-tab state syncing for React apps (my use case), or any application that requires knowing what is stored before writing, if the api offered the ability to read before writing as part of a single transaction. Consider the transaction method of Dexie.js: [https://github.com/dfahlander/Dexie.js/wiki/Dexie.transaction()](https://github.com/dfahlander/Dexie.js/wiki/Dexie.transaction%28%29)

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by examining the existing getItem and setItem APIs and how IndexedDB transactions are created, then compare the required behavior with Dexie.js transactions. Done means offering a read-before-write operation that remains atomic across multiple tabs without introducing the reported race condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.