diff --git a/src/Fabulous/Cmd.fs b/src/Fabulous/Cmd.fs index 4a4b96956..376a3890b 100644 --- a/src/Fabulous/Cmd.fs +++ b/src/Fabulous/Cmd.fs @@ -196,7 +196,7 @@ module Cmd = fun (value: 'value) -> [ fun dispatch -> lock funLock (fun () -> - if cts <> null then + if not(isNull cts) then cts.Cancel() cts.Dispose() @@ -209,7 +209,7 @@ module Cmd = lock funLock (fun () -> dispatch(fn value) - if cts <> null then + if not(isNull cts) then cts.Dispose() cts <- null) }, diff --git a/src/Fabulous/Component.fs b/src/Fabulous/Component.fs index 48ec99459..f16277a66 100644 --- a/src/Fabulous/Component.fs +++ b/src/Fabulous/Component.fs @@ -302,7 +302,7 @@ type Component(treeContext: ViewTreeContext, body: ComponentBody, context: Compo node member private this.RenderInternal() = - if _body = null then + if isNull body then () // Component has been disposed else let prevRootWidget = _widget @@ -320,10 +320,10 @@ type Component(treeContext: ViewTreeContext, body: ComponentBody, context: Compo Reconciler.update treeContext.CanReuseView (ValueSome prevRootWidget) currRootWidget viewNode member this.Dispose() = - if _contextSubscription <> null then + if not(isNull _contextSubscription) then _contextSubscription.Dispose() - if _context <> null then + if not(isNull _context) then _context.Dispose() _body <- null @@ -336,7 +336,7 @@ type Component(treeContext: ViewTreeContext, body: ComponentBody, context: Compo member this.Dispose() = this.Dispose() member this.Render(_) = - if _body = null then + if isNull _body then () // Component has been disposed else treeContext.SyncAction(this.RenderInternal) diff --git a/src/Fabulous/View.fs b/src/Fabulous/View.fs index fd7916147..423a2df26 100644 --- a/src/Fabulous/View.fs +++ b/src/Fabulous/View.fs @@ -37,7 +37,7 @@ module View = let fnWithBoxing (msg: obj) = let oldFn = unbox obj> oldAttr.Value - if msg <> null && typeof<'newMsg>.IsAssignableFrom(msg.GetType()) then + if not(isNull msg) && typeof<'newMsg>.IsAssignableFrom(msg.GetType()) then box msg else oldFn msg |> unbox<'oldMsg> |> fn |> box @@ -46,7 +46,7 @@ module View = let defaultWith () = let mappedFn (msg: obj) = - if msg <> null && typeof<'newMsg>.IsAssignableFrom(msg.GetType()) then + if not(isNull msg) && typeof<'newMsg>.IsAssignableFrom(msg.GetType()) then box msg else unbox<'oldMsg> msg |> fn |> box diff --git a/src/Fabulous/ViewNode.fs b/src/Fabulous/ViewNode.fs index 4efed81de..6aa4d5518 100644 --- a/src/Fabulous/ViewNode.fs +++ b/src/Fabulous/ViewNode.fs @@ -155,7 +155,7 @@ type ViewNode = if this.targetRef.IsAlive then let comp = this.treeContext.GetComponent(this.targetRef.Target) :?> IDisposable - if comp <> null then + if not(isNull comp) then comp.Dispose() this.treeContext.SetComponent null this.targetRef.Target