A Minimalistic Wrapper for IndexedDB
APACHE-2.0 License
Bot releases are visible (Hide)
Published by dfahlander over 1 year ago
Fixes #1760: ReadonlyError: Write transactions not allowed within liveQueries
Published by dfahlander over 1 year ago
dexie-cloud-addon: Behave when resetting database without reloading page. c3705a784d543798eef2a05c686369c8e699065a
dexie: Fix #1736 Optimistic cache not purged on database deletion
Published by dfahlander over 1 year ago
Thanks to everyone that tried out 4.0.1-alpha.17 and found the issues that are now fixed!
Published by dfahlander over 1 year ago
This release replaces 4.0.1-alpha.12, 4.0.1-alpha.13 and 4.0.1-alpha.14 due to issues #1730, #1731 and a few other issues fixed in PR #1733
The biggest news with this release is the initial support for common cache for live queries that enables multiple liveQuery observables targeting the same set of queries to reuse a single request towards indexedDB and to be immediately triggered as soon as data is being mutated. In practice, this will become a big game changer for large apps that has many ongoing liveQueries going on targeting large amount of data and possibly targeting the same data from different components.
Before the flow was pretty simple but could take some time from a mutation until a change was visible in the app if the app had many components using liveQuery and where the results of the queries were large.
So basically, liveQueries will only request IndexedDB at startup and two identical queries will only result in a single query towards IndexedDB.
Now this is the initial version of this and only certain queries can utilize this:
db.transaction('r', ...)
, the user expects isolation, so optimistic updates won't be used.Example of optimised queries:
Example of non-optimized queries in this initial version:
PRs:
Other changes:
liveQuery(()=>db.friends.add({...}))
){cache: 'immutable' | 'cloned' | 'disabled'}
. The default is 'cloned' but 'immutable' would give better performance because the cached results can be returned directly to the caller without having to deep clone it. However, the data will be frozen so if the liveQuery callback would try to set properties or call mutating array operations on the results, it will fail to do so if having { cache: 'immutable' }
. array.sort() is one example of a commonly used mutable operation. Workaround is to use array.slice().sort() instead..d.mts
files to support import
types properly.Published by dfahlander over 1 year ago
This release is replaced by 4.0.1-alpha.17
Published by dfahlander over 1 year ago
This release is replaced by 4.0.1-alpha.17
Published by dfahlander over 1 year ago
Fixes in this maintenance release:
hasValue()
). The optimisation requires dexie@>=3.2.4 or [email protected] together with [email protected].Published by dfahlander over 1 year ago
This release (and related dexie-react-hooks release) comes with better behavior of liveQuery(). useLiveQuery() and useObservable() in SSR environments, as it makes sure that calling these from a node runtime without any indexedDB envirnomnent will result in a no-op. The result: Use these tools the same in Next.js as in vanilla React and in SvelteKIT as in vanilla Svelte - no need to check for SSR in application code anymore and no need to dynamically imported components doing dexie queries.
We also fixed the typings of our Observables returned from liveQuery() to be type-compatible with Svelte Readables (this was an issue when consuming liveQuery()
results in Svelte using typescript).
Svelte users should install this prerelase of dexie instead of the stable version, but NextJS users may stay on the stable version of dexie if they prefer, and just upgrade dexie-react-hooks.
Published by dfahlander over 1 year ago
Append sourceMappingUrl in minified files
This fix makes the all JS files in the dist folder have the source mapping file pointed out so that bundlers can generate a correct final map file for the application or library that bundles dexie into it.
If dexie was used without bundling it into the app, this change will have no benefit as chrome devtools is still able to locate the map files without the mapfile comment-line.
Published by dfahlander over 1 year ago
In Dexie 4.0.1-alpha.6, Table.bulkUpdate() was introduced as well as improving the typings of Table.update(), Collection.modify() to using typescript template literals that would correcltly type the changes
argument and provide a nice code completion. However, there was a typings bug in this release that made the typings unusable for updating nested properties.
This version fixes the typings of Table.update(), Table.bulkUpdate() and Collection.modify() so that they work according to the expected format.
The typings in this release requires Typescript 4.8 or later in order to accept numeric keypaths and allow updating individual array items.
A new type UpdateSpec<T>
is expected as the second argument to Table.update(). This type can also be imported from dexie when the library user need to build the updateSpec using custom code before finally send along to Table.update() or in an array keysAndChanges to Table.bulkUpdate().
import type { UpdateSpec } from 'dexie';
interface Contact {
name: string;
address: Address;
}
interface Address {
city: string;
street: string;
streetNo: number;
}
let updateSpec: UpdateSpec<Contact> = {};
updateSpec["address.streetNo"] = 44;
db.contacts.update(1, updateSpec);
Published by dfahlander over 1 year ago
Bugfixes:
This was fixed for 4.x but with this release it is also fixed in the official latest stable version of dexie.
Published by dfahlander almost 2 years ago
News:
Typings:
dexie-cloud addon (4.0.1-beta.26)
Other addons
Misc
indexedDB.cmp()
and make use of the faster js version everywherePublished by dfahlander over 2 years ago
Published by dfahlander over 2 years ago
Prohibit possible prototype pollution in Dexie.setByKeyPath() (https://github.com/dexie/Dexie.js/commit/1d655a69b9f28c3af6fae10cf5c61df387dc689b)
Fix #1473 Cannot use Dexie in react-native
A corresponding release 3.2.2 contains the same fixes for 3.x.
Published by dfahlander over 2 years ago
Prohibit possible prototype pollution in Dexie.setByKeyPath() (https://github.com/dexie/Dexie.js/commit/1d655a69b9f28c3af6fae10cf5c61df387dc689b)
Fix #1473 Cannot use Dexie in react-native
A corresponding release 4.0.0-alpha.3 contains the same fixes for 4.x.
Published by dfahlander over 2 years ago
Published by dfahlander almost 3 years ago
Should resolve #1439 and #1369 by extending the "exports" field to include "require" compliant version of dexie.
Published by dfahlander almost 3 years ago
The initial release on 4.0. Currently pretty much identical to 3.2.1+ but with:
Entity
that can be optionally used as a base class in order to resolve dependency issues when mapping tables to classes. A subclass of Entity has a private property this.db
which is the Dexie instance it originates from. Entity
subclasses are not meant to be constructed by application code.
export class Friend extends Entity<FriendsDB> {
id!: number;
name!: string;
age!: number;
birthday() {
return this.db.friends.update(this.id, friend => ++friend.age);
}
}
export class FriendsDB extends Dexie {
friends!: Table<Friend, 'id'>;
constructor() {
super("FriendsDB");
this.version(1).stores({
friends: '++id, name, age'
});
this.friends.mapToClass(Friend);
}
}
Published by dfahlander almost 3 years ago
Contains a workaround for Chrome issue #613. Needs to be tested in the field a while before we can release this publicly.
Published by dfahlander almost 3 years ago
After one year in alpha, beta and RC, Dexie.js with liveQuery() is now officially released. The main reason for this new feature is better integration with frontend libraries like React, Svelte, Vue and Angular.
Together with this release, the website https://dexie.org also got a face lift with tutorials for React, Svelte, Vue and Angular.
Take a look past the updated website. Old tutorials are replaced with modern relevant framework specific ones. We've added React, Svelte, Vue and Angular samples on the landing page.
{allKeys: true}
to bulkPut() and bulkAdd() will be equally fast as not providing that option.