Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Just a little bit more renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoteTheMighty committed Dec 3, 2018
1 parent aa56c18 commit 81cd96c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/Component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ function Component:__mount(reconciler, virtualNode)
virtualNode.context = instance._context

internalData.setStateBlockedReason = "render"
local children = instance:render()
local renderResult = instance:render()
internalData.setStateBlockedReason = nil

reconciler.updateVirtualNodeChildrenFromElements(virtualNode, hostParent, children)
reconciler.updateVirtualNodeWithRenderResult(virtualNode, hostParent, renderResult)

if instance.didMount ~= nil then
instance:didMount()
Expand Down Expand Up @@ -292,7 +292,7 @@ function Component:__update(updatedElement, updatedState)
local renderResult = virtualNode.instance:render()
internalData.setStateBlockedReason = nil

reconciler.updateVirtualNodeChildrenFromElements(virtualNode, virtualNode.hostParent, renderResult)
reconciler.updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, renderResult)

if self.didUpdate ~= nil then
self:didUpdate(oldProps, oldState)
Expand Down
18 changes: 9 additions & 9 deletions lib/createReconciler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ local function createReconciler(renderer)
end
end

local function updateVirtualNodeChildrenFromElements(virtualNode, hostParent, newChildElements)
if newChildElements == nil
or typeof(newChildElements) == "boolean"
or Type.of(newChildElements) == Type.Element
or Type.of(newChildElements) == Type.Fragment
local function updateVirtualNodeWithRenderResult(virtualNode, hostParent, renderResult)
if renderResult == nil
or typeof(renderResult) == "boolean"
or Type.of(renderResult) == Type.Element
or Type.of(renderResult) == Type.Fragment
then
updateVirtualNodeChildren(virtualNode, hostParent, newChildElements)
updateVirtualNodeChildren(virtualNode, hostParent, renderResult)
else
-- TODO: Better error message
Logging.error(("%s\n%s"):format(
Expand Down Expand Up @@ -125,7 +125,7 @@ local function createReconciler(renderer)
local function updateFunctionVirtualNode(virtualNode, newElement)
local children = newElement.component(newElement.props)

updateVirtualNodeChildrenFromElements(virtualNode, virtualNode.hostParent, children)
updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, children)

return virtualNode
end
Expand Down Expand Up @@ -245,7 +245,7 @@ local function createReconciler(renderer)

local children = element.component(element.props)

updateVirtualNodeChildrenFromElements(virtualNode, virtualNode.hostParent, children)
updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, children)
end

local function mountPortalVirtualNode(virtualNode)
Expand Down Expand Up @@ -363,7 +363,7 @@ local function createReconciler(renderer)
unmountVirtualNode = unmountVirtualNode,
updateVirtualNode = updateVirtualNode,
updateVirtualNodeChildren = updateVirtualNodeChildren,
updateVirtualNodeChildrenFromElements = updateVirtualNodeChildrenFromElements,
updateVirtualNodeWithRenderResult = updateVirtualNodeWithRenderResult,
}

return reconciler
Expand Down

0 comments on commit 81cd96c

Please sign in to comment.