diff --git a/README.md b/README.md index 9254261..47f4731 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,14 @@ const model = observable({ count: 0 }); const add = ()=>model.count++; const View1 = observer(() { - return
{model.count}
+ return
{model.count}
; }); const View2 = observer(() { return
{model.count}
+ ; }); ``` @@ -53,7 +53,7 @@ const View = observer(() { return
{model.count}
+ ; }); ``` @@ -69,8 +69,10 @@ const user = observable({ const View = observer(() { // The fullName will be cached and responsive - const fullName = useComputed(()=>`${user.firstName} ${user.lastName}`); - return
{fullName}
+ const fullName = useComputed(()=>{ + return `${user.firstName} ${user.lastName}`; + }); + return
{fullName}
; }); ``` @@ -88,7 +90,7 @@ const View = observer(() { useAutoRun(()=>{ console.log('count:', model.count); }); - return
{model.count}
+ return
{model.count}
; }); ``` @@ -105,7 +107,7 @@ const View = observer(() { useWatch(()=>model.count%10, (oldValue, newValue)=>{ console.log(`old: ${oldValue}, new: ${newValue}`); }); - return
{model.count}
+ return
{model.count}
; }); ``` @@ -141,7 +143,7 @@ class View extends React.Component { return
{this.message}
+ ; } } ``` @@ -168,7 +170,7 @@ class View extends React.Component { return
{this.model.message}
+ ; } } ``` \ No newline at end of file diff --git a/examples/benchmark-mota.tsx b/examples/benchmark-mota.tsx index 122e5cf..6160275 100644 --- a/examples/benchmark-mota.tsx +++ b/examples/benchmark-mota.tsx @@ -7,7 +7,7 @@ import { useEffect } from 'react'; ObserveConfig.maxDependencies = Number.MAX_SAFE_INTEGER; ObserveConfig.maxHandlers = Number.MAX_SAFE_INTEGER; - + let renderCount = 0; const markRender = () => { diff --git a/package.json b/package.json index 6f6276f..27534e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mota", - "version": "8.1.2", + "version": "8.1.3", "description": "An extremely lightweight and responsive state management library", "module": "./dist/mota-es.js", "main": "./dist/mota-cjs.js", @@ -21,7 +21,7 @@ }, "license": "MIT", "dependencies": { - "ober": "8.2.6", + "ober": "8.2.8", "tslib": "*" }, "devDependencies": { diff --git a/src/info.ts b/src/info.ts index 2e0dcc9..a11d2a2 100644 --- a/src/info.ts +++ b/src/info.ts @@ -5,4 +5,4 @@ */ export const name = "mota"; -export const version = "8.1.2"; +export const version = "8.1.3"; diff --git a/src/observer.ts b/src/observer.ts index 33005c6..c60499d 100644 --- a/src/observer.ts +++ b/src/observer.ts @@ -21,9 +21,7 @@ function createReactiver( bind = true ) { const update = (info?: ObserveData) => - isSyncRequired(info?.value) - ? requestUpdate() - : nextTick(requestUpdate, true); + isSyncRequired(info?.value) ? requestUpdate() : nextTick(requestUpdate); return reactivable(render, { bind, update, batch: false }); }