[graph] edge weight work with useTransition, still doesn't work correctly

parent 63692972
...@@ -125,12 +125,13 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt ...@@ -125,12 +125,13 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt
, state , state
} _ = do } _ = do
-- TODO -- transition <- R2.useTransition
useTransition
let onChange' rng = do let onChange' rng = do
-- here.log2 "[edgeWeightControl] debounce rng" rng -- here.log2 "[edgeWeightControl] debounce rng" rng
let _ = spy "debounce rng" rng let _ = spy "debounce rng" rng
let _ = spy "debounce state" state let _ = spy "debounce state" state
-- R2.startTransition transition (\_ -> T.write_ rng state)
T.write_ rng state T.write_ rng state
onChange = Debounce.debounce onChange' 1000 onChange = Debounce.debounce onChange' 1000
......
'use strict'; 'use strict';
import { useTransition } from 'react';
export function _addRootElement(rootElem) { export function _addRootElement(rootElem) {
document.body.insertBefore( document.body.insertBefore(
rootElem, rootElem,
...@@ -65,4 +63,10 @@ export function _scrollIntoView(el) { ...@@ -65,4 +63,10 @@ export function _scrollIntoView(el) {
} }
export const useTransition; export const isPendingTransitionImpl = (t) => () => {
return t[0]();
}
export const startTransitionImpl = (t) => (f) => () => {
return t[1](f);
}
...@@ -652,4 +652,20 @@ setInputValue elNullableRef val = case toMaybe (R.readRef elNullableRef) of ...@@ -652,4 +652,20 @@ setInputValue elNullableRef val = case toMaybe (R.readRef elNullableRef) of
-- TODO useTransition? -- TODO useTransition?
foreign import data Transition :: Type foreign import data Transition :: Type
foreign import useTransitionImpl :: -- foreign import useTransitionImpl :: R.Hooks Transition
-- useTransition :: R.Hooks Transition
-- useTransition = useTransitionImpl
useTransition :: R.Hooks Transition
useTransition = hook $ \_ -> pure $ react ... "useTransition" $ []
foreign import isPendingTransitionImpl :: Transition -> R.Hooks Boolean
isPendingTransition :: Transition -> R.Hooks Boolean
isPendingTransition = isPendingTransitionImpl
foreign import startTransitionImpl :: Transition -> (Unit -> Effect Unit) -> Effect Unit
startTransition :: Transition -> (Unit -> Effect Unit) -> Effect Unit
startTransition = startTransitionImpl
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