From 2c99f59e97bbb26f56e2e1c769a9ab6e4e5afa52 Mon Sep 17 00:00:00 2001 From: ronreg-ribdev Date: Sun, 3 Jan 2021 01:52:58 -0800 Subject: [PATCH] refactor state-handling in helper core --- gall-app/urbit/app/browsermanager.hoon | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gall-app/urbit/app/browsermanager.hoon b/gall-app/urbit/app/browsermanager.hoon index f74cdad..72e4b5c 100644 --- a/gall-app/urbit/app/browsermanager.hoon +++ b/gall-app/urbit/app/browsermanager.hoon @@ -58,8 +58,10 @@ `this %browsermanager-action =/ action !<(action:browsermanager vase) - =/ new-state state(access-counts (add 1 access-counts.state)) - [(handle-action action) this(state new-state)] + =/ output (handle-action action state) + =/ new-actions=(list card) +2:output + =/ new-state=state-0 +3:output + [new-actions this(state new-state)] == ++ on-save ~& 'on-save' @@ -73,9 +75,10 @@ -- :: Helper core ++ handle-action - |= action=action:browsermanager - ^- (list card) + |= [action=action:browsermanager state=state-0] + ^- [(list card) state-0] ~& 'Browser Manager action' ~& >> action - ~ + =/ new-state state(access-counts (add 1 access-counts.state)) + [~ new-state] --