Skip to content

Commit

Permalink
Merge pull request #28 from luisherranz/fix-production-build
Browse files Browse the repository at this point in the history
Fix production build
  • Loading branch information
luisherranz committed Jun 26, 2023
2 parents b87f4a5 + cf226ba commit ff7d151
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-rivers-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"deepsignal": patch
---

Fix production tests and a couple of problems in production with `peek` and the `ownKeys` trap.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function createEsbuildPlugin() {

// Aliasing: If "MINIFY" is set to "true" we use the dist/
// files instead of those from src/
build.onResolve({ filter: /^@preact\/.*/ }, args => {
build.onResolve({ filter: /^deepsignal\/.*/ }, args => {
const pkg = alias[args.path];
return {
path: pkg,
Expand Down
6 changes: 4 additions & 2 deletions packages/deepsignal/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const peek = <
): RevertDeepSignal<RevertDeepSignalObject<T>[K]> => {
peeking = true;
const value = obj[key];
peeking = false;
try {
peeking = false;
} catch (e) {}
return value as RevertDeepSignal<RevertDeepSignalObject<T>[K]>;
};

Expand Down Expand Up @@ -115,7 +117,7 @@ const objectHandlers = {
},
ownKeys(target: object): (string | symbol)[] {
if (!objToIterable.has(target)) objToIterable.set(target, signal(0));
objToIterable.get(target).value;
objToIterable.get(target).value = objToIterable.get(target).value;
return Reflect.ownKeys(target);
},
};
Expand Down

0 comments on commit ff7d151

Please sign in to comment.