helium icon indicating copy to clipboard operation
helium copied to clipboard

Can't read from a context in `input` subscription

Open IsometricShahil opened this issue 4 years ago • 0 comments

In a child element, a context can't be read from in a input sub though writing to it is perfectly valid. Sample elements to reproduce:-

local ChildFactory = helium(function(param, view)
	local ctx = context.get("ctx")
	input("clicked", function()
		local c = ctx.value -- FAILS
	end)
	return function()
		love.graphics.print(ctx.value, 20, 20)
	end
end)

local ParentFactory = helium(function(param, view)
	local ctx = context.use("ctx", {value = "Lorem ipsum"})
	local c = ChildFactory({}, 100, 100)
	return function()
		c:draw()
	end
end)

IsometricShahil avatar Nov 10 '21 10:11 IsometricShahil