Skip to content

Commit 1abd6ba

Browse files
committed
Update package version to 0.1.22, add enableMapSet function to immer-utils for Map and Set support, and expand exports in index.ts to include the new function.
1 parent 4398fdd commit 1abd6ba

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flexsurfer/reflex",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

src/immer-utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* These check if the value is actually a draft before calling the immer functions
44
*/
55

6-
import { isDraft, original as immerOriginal, current as immerCurrent } from 'immer';
6+
import { isDraft, original as immerOriginal, current as immerCurrent, enableMapSet as immerEnableMapSet } from 'immer';
77

88
/**
99
* Safe version of immer's original function
@@ -22,3 +22,11 @@ export function original<T>(value: T): T {
2222
export function current<T>(value: T): T {
2323
return isDraft(value) ? immerCurrent(value) : value;
2424
}
25+
26+
/**
27+
* Enable Map and Set support in Immer
28+
* This allows Immer to handle Map and Set objects properly in drafts
29+
*/
30+
export function enableMapSet(): void {
31+
immerEnableMapSet();
32+
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Re-export main functionality
22
export { initAppDb, getAppDb } from './db';
33

4-
export { original, current } from './immer-utils';
4+
export { original, current, enableMapSet } from './immer-utils';
55

66
export { regEvent, regEventErrorHandler, defaultErrorHandler } from './events';
77
export { regSub, getSubscriptionValue } from './subs';

0 commit comments

Comments
 (0)