From 3fed79da31f555279be9853ee2efa3b6fbb58353 Mon Sep 17 00:00:00 2001 From: pSapien Date: Tue, 28 Sep 2021 12:25:31 +0545 Subject: [PATCH 1/2] add show level and hide level in react-kit --- .gitignore | 1 + src/transition/TransitionController.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ccf40ce..2b4c416 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules dist es6 .DS_Store +.vscode \ No newline at end of file diff --git a/src/transition/TransitionController.ts b/src/transition/TransitionController.ts index 0a36b77..1e0b836 100644 --- a/src/transition/TransitionController.ts +++ b/src/transition/TransitionController.ts @@ -230,6 +230,7 @@ export class TransitionController { // Continue with the remaining actions only if (this.queue.length && !this.shouldHoldAction()) { this.startDispatch(this.queue.shift(), prevState); + this.backLogs.forEach(cb => cb()); } }); } @@ -321,13 +322,21 @@ export class TransitionController { return value; } - useBackLog(max: number) { - const [backlog, setBackLog] = useState(this.queue.length > max); + useBackLog(showLevel: number, hideLevel?: number) { + const [backlog, setBackLog] = useState(this.queue.length >= showLevel); + if (hideLevel === undefined) hideLevel = showLevel; + useEffect(() => { return subscribe(this.backLogs, () => { - setBackLog(this.queue.length > max); + setBackLog((prevVisible) => { + if (prevVisible) { + return this.queue.length >= hideLevel; + } else { + return this.queue.length >= showLevel; + } + }); }); - }, [max]); + }, [showLevel, hideLevel]); return backlog; } From d9b4ffbd195ccc0009b9f7fdbbbf06e5731e4593 Mon Sep 17 00:00:00 2001 From: bhoos-devops Date: Tue, 28 Sep 2021 06:41:14 +0000 Subject: [PATCH 2/2] v2.0.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f46c23..027a5f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bhoos/react-kit", - "version": "2.0.6", + "version": "2.0.7", "description": "Bhoos React Library", "main": "dist/index.js", "module": "es6/index.js",