[ui] scroll into view once, on page load

Do it only for the selected component.

This prevents multiple scroll calls, when it was in the (recursive)
tree component.
parent 0ef81ea3
Pipeline #7126 passed with stages
in 17 minutes and 3 seconds
......@@ -81,8 +81,7 @@ plusCpt :: R.Component Plus
plusCpt = here.component "plus" cpt
where
cpt {} _ = do
{ backend, pinnedTreeId, route, showLogin, showSearch } <- Store.use
route' <- T.useLive T.unequal route
{ backend, pinnedTreeId, showLogin, showSearch } <- Store.use
-- Behaviors
let
......
......@@ -267,6 +267,13 @@ nodeSpanCpt = here.component "nodeSpan" cpt
let action = NT.InsertCallback (NT.UpdateTree props.id) ("node-span-" <> show props.id) cb
Notifications.performAction ws action
R.useEffectOnce' $ do
when isSelected $ do
mEl <- R2.querySelector ".forest-layout__tree .mainleaf--selected"
case mEl of
Nothing -> pure unit
Just el -> R2.scrollIntoView el
-- Render
pure $
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment