Skip to content

Commit

Permalink
fix: new failed test (#43)
Browse files Browse the repository at this point in the history
* add new test

* Update StateSnapshot.js

---------

Co-authored-by: reaper <[email protected]>
  • Loading branch information
nosferatu500 and barelyhuman authored Mar 13, 2023
1 parent 47d02d0 commit 4a02e5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/StateSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function isSameMemmberExpression(first, second) {
first.object.type === 'Identifier' &&
second.object.type === 'Identifier'
) {
return first.object.type === second.object.type
return first.object.name === second.object.name
}
} else {
return false
Expand Down
13 changes: 13 additions & 0 deletions tests/StateSnapshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ export function Test2(){
);
}
`,
`const state = proxyWithHistory({ count: 0 });
function App() {
const obj = new MyObject();
obj.scale = 0;
const [fakeObj, setFakeObj] = useState<MyObject>(obj)
const {count} = useSnapshot(state.value)
return <div></div>;
}
`,
`const state = proxy({ someObj: { count: 0 } });
function App() {
const snap = useSnapshot(state);
Expand Down

0 comments on commit 4a02e5f

Please sign in to comment.