mirror of
https://github.com/ilyakooo0/reflex-dom.git
synced 2024-09-11 06:35:30 +03:00
Update changelog; Bump version
This commit is contained in:
parent
b31529a469
commit
7ff258f114
@ -1,5 +1,9 @@
|
||||
# Revision history for reflex-dom-core
|
||||
|
||||
## 0.6.2.0
|
||||
|
||||
* ([#400](https://github.com/reflex-frp/reflex-dom/pull/400/files)) Set value of input elements in static renderer
|
||||
|
||||
## 0.6.1.0
|
||||
|
||||
* Bump version bounds
|
||||
|
@ -1,6 +1,6 @@
|
||||
cabal-version: 1.24
|
||||
Name: reflex-dom-core
|
||||
Version: 0.6.1.0
|
||||
Version: 0.6.2.0
|
||||
Synopsis: Functional Reactive Web Apps with Reflex
|
||||
Description:
|
||||
Web applications without callbacks or side-effects.
|
||||
|
@ -49,6 +49,7 @@ module Reflex.Dom.Builder.Immediate
|
||||
, HydrationMode (..)
|
||||
, HydrationRunnerT (..)
|
||||
, runHydrationRunnerT
|
||||
, runHydrationRunnerTWithFailure
|
||||
, ImmediateDomBuilderT
|
||||
, runHydrationDomBuilderT
|
||||
, getHydrationMode
|
||||
@ -292,15 +293,28 @@ localRunner (HydrationRunnerT m) s parent = do
|
||||
|
||||
{-# INLINABLE runHydrationRunnerT #-}
|
||||
runHydrationRunnerT
|
||||
:: (MonadRef m, Ref m ~ IORef, Monad m, PerformEvent t m, MonadFix m, MonadReflexCreateTrigger t m, MonadJSM m, MonadJSM (Performable m))
|
||||
=> HydrationRunnerT t m a -> Maybe Node -> Node -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a
|
||||
runHydrationRunnerT m = runHydrationRunnerTWithFailure m (pure ()) -- (HydrationRunnerT m) onFailure s parent events = flip runDomRenderHookT events $ flip runReaderT parent $ do
|
||||
-- (a, s') <- runStateT m (HydrationState s False)
|
||||
-- traverse_ removeSubsequentNodes $ _hydrationState_previousNode s'
|
||||
-- when (_hydrationState_failed s') $ liftIO $ putStrLn "reflex-dom warning: hydration failed: the DOM was not as expected at switchover time. This may be due to invalid HTML which the browser has altered upon parsing, some external JS altering the DOM, or the page being served from an outdated cache."
|
||||
-- when (_hydrationState_failed s') $ liftIO onFailure
|
||||
-- pure a
|
||||
|
||||
{-# INLINABLE runHydrationRunnerTWithFailure #-}
|
||||
runHydrationRunnerTWithFailure
|
||||
:: (MonadRef m, Ref m ~ IORef, Monad m, PerformEvent t m, MonadFix m, MonadReflexCreateTrigger t m, MonadJSM m, MonadJSM (Performable m))
|
||||
=> HydrationRunnerT t m a -> IO () -> Maybe Node -> Node -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a
|
||||
runHydrationRunnerT (HydrationRunnerT m) onFailure s parent events = flip runDomRenderHookT events $ flip runReaderT parent $ do
|
||||
runHydrationRunnerTWithFailure (HydrationRunnerT m) onFailure s parent events = flip runDomRenderHookT events $ flip runReaderT parent $ do
|
||||
(a, s') <- runStateT m (HydrationState s False)
|
||||
traverse_ removeSubsequentNodes $ _hydrationState_previousNode s'
|
||||
when (_hydrationState_failed s') $ liftIO $ putStrLn "reflex-dom warning: hydration failed: the DOM was not as expected at switchover time. This may be due to invalid HTML which the browser has altered upon parsing, some external JS altering the DOM, or the page being served from an outdated cache."
|
||||
when (_hydrationState_failed s') $ liftIO onFailure
|
||||
pure a
|
||||
|
||||
|
||||
|
||||
instance MonadReflexCreateTrigger t m => MonadReflexCreateTrigger t (HydrationRunnerT t m) where
|
||||
{-# INLINABLE newEventWithTrigger #-}
|
||||
newEventWithTrigger = lift . newEventWithTrigger
|
||||
|
@ -64,22 +64,41 @@ mainHydrationWidgetWithHead = mainHydrationWidgetWithHead'
|
||||
{-# INLINABLE mainHydrationWidgetWithHead' #-}
|
||||
-- | Warning: `mainHydrationWidgetWithHead'` is provided only as performance tweak. It is expected to disappear in future releases.
|
||||
mainHydrationWidgetWithHead' :: HydrationWidget () () -> HydrationWidget () () -> JSM ()
|
||||
mainHydrationWidgetWithHead' = mainHydrationWidgetWithSwitchoverAction' (pure ()) (pure ())
|
||||
mainHydrationWidgetWithHead' = mainHydrationWidgetWithSwitchoverAction' (pure ())
|
||||
|
||||
{-# INLINE mainHydrationWidgetWithSwitchoverAction #-}
|
||||
mainHydrationWidgetWithSwitchoverAction :: IO () -> JSM () -> (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> JSM ()
|
||||
mainHydrationWidgetWithSwitchoverAction :: JSM () -> (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> JSM ()
|
||||
mainHydrationWidgetWithSwitchoverAction = mainHydrationWidgetWithSwitchoverAction'
|
||||
|
||||
{-# INLINABLE mainHydrationWidgetWithSwitchoverAction' #-}
|
||||
-- | Warning: `mainHydrationWidgetWithSwitchoverAction'` is provided only as performance tweak. It is expected to disappear in future releases.
|
||||
mainHydrationWidgetWithSwitchoverAction' :: IO () -> JSM () -> HydrationWidget () () -> HydrationWidget () () -> JSM ()
|
||||
mainHydrationWidgetWithSwitchoverAction' onFailure switchoverAction head' body = do
|
||||
runHydrationWidgetWithHeadAndBody onFailure switchoverAction $ \appendHead appendBody -> do
|
||||
mainHydrationWidgetWithSwitchoverAction' :: JSM () -> HydrationWidget () () -> HydrationWidget () () -> JSM ()
|
||||
mainHydrationWidgetWithSwitchoverAction' = mainHydrationWidgetWithSwitchoverActionWithFailure' (pure ())
|
||||
|
||||
|
||||
{-# INLINABLE mainHydrationWidgetWithSwitchoverActionWithFailure' #-}
|
||||
-- | Warning: `mainHydrationWidgetWithSwitchoverActionWithFaiilure'` is provided only as performance tweak. It is expected to disappear in future releases.
|
||||
mainHydrationWidgetWithSwitchoverActionWithFailure' :: IO () -> JSM () -> HydrationWidget () () -> HydrationWidget () () -> JSM ()
|
||||
mainHydrationWidgetWithSwitchoverActionWithFailure' onFailure switchoverAction head' body = do
|
||||
runHydrationWidgetWithHeadAndBodyWithFailure onFailure switchoverAction $ \appendHead appendBody -> do
|
||||
appendHead head'
|
||||
appendBody body
|
||||
|
||||
{-# INLINABLE attachHydrationWidget #-}
|
||||
attachHydrationWidget
|
||||
:: JSM ()
|
||||
-> JSContextSingleton ()
|
||||
-> ( Event DomTimeline ()
|
||||
-> IORef HydrationMode
|
||||
-> Maybe (IORef [(Node, HydrationRunnerT DomTimeline (DomCoreWidget ()) ())])
|
||||
-> EventChannel
|
||||
-> PerformEventT DomTimeline DomHost (a, IORef (Maybe (EventTrigger DomTimeline ())))
|
||||
)
|
||||
-> IO (a, FireCommand DomTimeline DomHost)
|
||||
attachHydrationWidget = attachHydrationWidgetWithFailure (pure ())
|
||||
|
||||
{-# INLINABLE attachHydrationWidgetWithFailure #-}
|
||||
attachHydrationWidgetWithFailure
|
||||
:: IO ()
|
||||
-> JSM ()
|
||||
-> JSContextSingleton ()
|
||||
@ -90,7 +109,7 @@ attachHydrationWidget
|
||||
-> PerformEventT DomTimeline DomHost (a, IORef (Maybe (EventTrigger DomTimeline ())))
|
||||
)
|
||||
-> IO (a, FireCommand DomTimeline DomHost)
|
||||
attachHydrationWidget onFailure switchoverAction jsSing w = do
|
||||
attachHydrationWidgetWithFailure onFailure switchoverAction jsSing w = do
|
||||
hydrationMode <- liftIO $ newIORef HydrationMode_Hydrating
|
||||
rootNodesRef <- liftIO $ newIORef []
|
||||
events <- newChan
|
||||
@ -106,7 +125,7 @@ attachHydrationWidget onFailure switchoverAction jsSing w = do
|
||||
rootNodes <- liftIO $ readIORef rootNodesRef
|
||||
let delayedAction = do
|
||||
for_ (reverse rootNodes) $ \(rootNode, runner) -> do
|
||||
let hydrate = runHydrationRunnerT runner onFailure Nothing rootNode events
|
||||
let hydrate = runHydrationRunnerTWithFailure runner onFailure Nothing rootNode events
|
||||
void $ runWithJSContextSingleton (runPostBuildT hydrate never) jsSing
|
||||
liftIO $ writeIORef hydrationMode HydrationMode_Immediate
|
||||
runWithJSContextSingleton (DOM.liftJSM switchoverAction) jsSing
|
||||
@ -121,6 +140,16 @@ type DomCoreWidget x = PostBuildT DomTimeline (WithJSContextSingleton x (Perform
|
||||
|
||||
{-# INLINABLE runHydrationWidgetWithHeadAndBody #-}
|
||||
runHydrationWidgetWithHeadAndBody
|
||||
:: JSM ()
|
||||
-> ( (forall c. HydrationWidget () c -> FloatingWidget () c) -- "Append to head" --TODO: test invoking this more than once
|
||||
-> (forall c. HydrationWidget () c -> FloatingWidget () c) -- "Append to body" --TODO: test invoking this more than once
|
||||
-> FloatingWidget () ()
|
||||
)
|
||||
-> JSM ()
|
||||
runHydrationWidgetWithHeadAndBody = runHydrationWidgetWithHeadAndBodyWithFailure (pure ())
|
||||
|
||||
{-# INLINABLE runHydrationWidgetWithHeadAndBodyWithFailure #-}
|
||||
runHydrationWidgetWithHeadAndBodyWithFailure
|
||||
:: IO ()
|
||||
-> JSM ()
|
||||
-> ( (forall c. HydrationWidget () c -> FloatingWidget () c) -- "Append to head" --TODO: test invoking this more than once
|
||||
@ -128,11 +157,11 @@ runHydrationWidgetWithHeadAndBody
|
||||
-> FloatingWidget () ()
|
||||
)
|
||||
-> JSM ()
|
||||
runHydrationWidgetWithHeadAndBody onFailure switchoverAction app = withJSContextSingletonMono $ \jsSing -> do
|
||||
runHydrationWidgetWithHeadAndBodyWithFailure onFailure switchoverAction app = withJSContextSingletonMono $ \jsSing -> do
|
||||
globalDoc <- currentDocumentUnchecked
|
||||
headElement <- getHeadUnchecked globalDoc
|
||||
bodyElement <- getBodyUnchecked globalDoc
|
||||
(events, fc) <- liftIO . attachHydrationWidget onFailure switchoverAction jsSing $ \switchover hydrationMode hydrationResult events -> do
|
||||
(events, fc) <- liftIO . attachHydrationWidgetWithFailure onFailure switchoverAction jsSing $ \switchover hydrationMode hydrationResult events -> do
|
||||
(postBuild, postBuildTriggerRef) <- newEventWithTriggerRef
|
||||
let hydrateDom :: DOM.Node -> HydrationWidget () c -> FloatingWidget () c
|
||||
hydrateDom n w = do
|
||||
|
@ -1772,7 +1772,7 @@ testWidgetDebug' hardFailure withDebugging beforeJS afterSwitchover bodyWidget =
|
||||
liftIO $ putMVar waitUntilSwitchover ()
|
||||
putStrLnDebug "put waitUntilSwitchover"
|
||||
putStrLnDebug "running mainHydrationWidgetWithSwitchoverAction"
|
||||
mainHydrationWidgetWithSwitchoverAction onFailure switchOverAction blank bodyWidget
|
||||
mainHydrationWidgetWithSwitchoverActionWithFailure' onFailure switchOverAction blank bodyWidget
|
||||
putStrLnDebug "syncPoint after mainHydrationWidgetWithSwitchoverAction"
|
||||
syncPoint
|
||||
application <- liftIO $ jsaddleOr defaultConnectionOptions entryPoint $ \_ sendResponse -> do
|
||||
|
Loading…
Reference in New Issue
Block a user