function Component.__update(D,e,C)if config.internalTypeChecks then internalAssert(Type.of(D)==Type.StatefulComponentInstance,"\073\110\118\097\108\105\100 \117\115\101 \111\102 \096\095\095\117\112\100\097\116\101\096")internalAssert(Type.of(e)==Type.Element or e==nil,"\069\120\112\101\099\116\101\100 \097\114\103 \035\049 \116\111 \098\101 \111\102 \116\121\112\101 \069\108\101\109\101\110\116 \111\114 \110\105\108")internalAssert(typeof(C)=="\116\097\098\108\101"or C==nil,"\069\120\112\101\099\116\101\100 \097\114\103 \035\050 \116\111 \098\101 \111\102 \116\121\112\101 \116\097\098\108\101 \111\114 \110\105\108")end local m=D[InternalData]local S=m.componentClass local I=D.props if e~=nil then I=e.props if S.defaultProps~=nil then I=assign({},S.defaultProps,I)end D:__validateProps(I)end local j=0 repeat local e local S=nil if m.pendingState~=nil then S=m.pendingState m.pendingState=nil end if C~=nil or I~=D.props then if S==nil then e=C or D.state else e=assign(S,C)end local m=D:__getDerivedState(I,e)if m~=nil then e=assign({},e,m)end C=nil else e=S end if not D:__resolveUpdate(I,e)then return false end j=j+1 if j>MAX_PENDING_UPDATES then error(tooManyUpdatesMessage:format(tostring(m.componentClass)),3)end until m.pendingState==nil return true end
--[[
	Internal method used by setState (to trigger updates based on state) and by
	the reconciler (to trigger updates based on props)

	Returns true if the update was completed, false if it was cancelled by shouldUpdate
]]
function Component:__update(updatedElement, updatedState)
	if config.internalTypeChecks then
		internalAssert(Type.of(self) == Type.StatefulComponentInstance, "Invalid use of `__update`")
		internalAssert(
			Type.of(updatedElement) == Type.Element or updatedElement == nil,
			"Expected arg #1 to be of type Element or nil"
		)
		internalAssert(
			typeof(updatedState) == "table" or updatedState == nil,
			"Expected arg #2 to be of type table or nil"
		)
	end

	local internalData = self[InternalData]
	local componentClass = internalData.componentClass

	local newProps = self.props
	if updatedElement ~= nil then
		newProps = updatedElement.props

		if componentClass.defaultProps ~= nil then
			newProps = assign({}, componentClass.defaultProps, newProps)
		end

		self:__validateProps(newProps)
	end

	local updateCount = 0
	repeat
		local finalState
		local pendingState = nil

		-- Consume any pending state we might have
		if internalData.pendingState ~= nil then
			pendingState = internalData.pendingState
			internalData.pendingState = nil
		end

		-- Consume a standard update to state or props
		if updatedState ~= nil or newProps ~= self.props then
			if pendingState == nil then
				finalState = updatedState or self.state
			else
				finalState = assign(pendingState, updatedState)
			end

			local derivedState = self:__getDerivedState(newProps, finalState)

			if derivedState ~= nil then
				finalState = assign({}, finalState, derivedState)
			end

			updatedState = nil
		else
			finalState = pendingState
		end

		if not self:__resolveUpdate(newProps, finalState) then
			-- If the update was short-circuited, bubble the result up to the caller
			return false
		end

		updateCount = updateCount + 1

		if updateCount > MAX_PENDING_UPDATES then
			error(tooManyUpdatesMessage:format(tostring(internalData.componentClass)), 3)
		end
	until internalData.pendingState == nil

	return true
end
