diff --git a/.gitignore b/.gitignore
index 14fa3cf1..5d950c23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,7 @@ yarn-error.log*
dist
es
lib
-.cache
+.*cache
.DS_Store
devtoolsDist
diff --git a/packages/overmind-react/src/index.test.tsx b/packages/overmind-react/src/index.test.tsx
index 0f007c83..03ce164a 100644
--- a/packages/overmind-react/src/index.test.tsx
+++ b/packages/overmind-react/src/index.test.tsx
@@ -88,7 +88,6 @@ describe('React', () => {
const FooComponent: React.FunctionComponent = () => {
const state = useState((state) => state.foo[0])
- console.log('WTF?')
renderCount++
return
{state.foo}
@@ -169,6 +168,7 @@ describe('React', () => {
return {(state as any).foo}
}
+ jest.spyOn(console, 'error') // suppress the error message
expect(() => {
render()
}).toThrow(Error)
diff --git a/packages/overmind-react/src/index.ts b/packages/overmind-react/src/index.ts
index 251250d4..cca8f7f3 100644
--- a/packages/overmind-react/src/index.ts
+++ b/packages/overmind-react/src/index.ts
@@ -71,56 +71,6 @@ const useCurrentComponent = () => {
: {}
}
-class ReactTrackerV18 {
- tree
- result
- cb
- updateCb
- constructor(tree: any) {
- this.tree = tree
- this.result = { state: tree.state }
- this.updateCb = () => {
- this.result = {
- state: this.tree.state,
- }
-
- if (this.cb) {
- this.cb()
- } else {
- this.tree.dispose()
- }
- }
- }
-
- subscribe = (cb) => {
- this.cb = cb
-
- return () => {
- if (IS_PRODUCTION) {
- this.tree.dispose()
- } else {
- // In development we do not dispose of the tree as React will do
- // "test runs" on effect hooks, it will rather be disposed when there is an
- // update to the tracked paths, but there is no longer a callback to trigger. This
- // can cause memory leaks in edge cases, but this is just development and does not matter
- delete this.cb
- }
- }
- }
-
- getState = () => {
- return this.result
- }
-
- track() {
- this.tree.track(this.updateCb)
- }
-
- stopTracking() {
- this.tree.stopTracking()
- }
-}
-
const useState = >(
cb?: (state: Context['state']) => any
): Context['state'] => {
@@ -134,7 +84,7 @@ const useState = >(
return overmind.state
}
- const { flushId, forceRerender } = useForceRerender()
+ const { forceRerender } = useForceRerender()
const trackStateTree = (
overmind as any
diff --git a/packages/overmind/src/Overmind.ts b/packages/overmind/src/Overmind.ts
index 55d4600a..d7d381eb 100644
--- a/packages/overmind/src/Overmind.ts
+++ b/packages/overmind/src/Overmind.ts
@@ -894,7 +894,6 @@ export class Overmind
} else {
const tree = this.proxyStateTreeInstance.getTrackStateTree()
let returnValue
- let disposer
const updateReaction = () => {
tree.trackScope(() => (returnValue = stateCallback(tree.state as any)))
disposer = tree.subscribe(() => {
diff --git a/packages/overmind/src/rehydrate.test.ts b/packages/overmind/src/rehydrate.test.ts
index cb9f2abf..220243fd 100644
--- a/packages/overmind/src/rehydrate.test.ts
+++ b/packages/overmind/src/rehydrate.test.ts
@@ -33,7 +33,7 @@ describe('REHYDRATE', () => {
foo: 'bar2',
})
})
- test.only('should allow rehydration of single class value', () => {
+ test('should allow rehydration of single class value', () => {
expect.assertions(1)
class User {
name = 'Bob'
diff --git a/packages/proxy-state-tree/src/TrackStateTree.ts b/packages/proxy-state-tree/src/TrackStateTree.ts
index a410f3f2..9356a75f 100644
--- a/packages/proxy-state-tree/src/TrackStateTree.ts
+++ b/packages/proxy-state-tree/src/TrackStateTree.ts
@@ -6,10 +6,6 @@ import {
ITrackStateTree,
} from './types'
-// @ts-ignore
-/// const registry = new FinalizationRegistry((message) => console.log(message))
-// let id = 0
-
export class TrackStateTree implements ITrackStateTree {
private disposeOnReset: Function
root: IProxyStateTree
@@ -21,8 +17,6 @@ export class TrackStateTree implements ITrackStateTree {
this.root = root
this.proxifier = root.proxifier
this.state = root.state
-
- // registry.register(this, id++ + ' has been collected')
}
trackPaths() {