When using the context in a template defined inside a Surface.View, both (old) <Context get={...}> and (new) prop name, :type, from_context: ... in a used component yields nil.
How to reproduce it
Use surface initialized with --layouts
Use context in live.sface or a component used by live.sface
Describe the bug
When using the context in a template defined inside a
Surface.View
, both (old)<Context get={...}>
and (new)prop name, :type, from_context: ...
in a used component yieldsnil
.How to reproduce it
--layouts
live.sface
or a component used bylive.sface
nil
The behavior you expected
The value is read correctly.
Your Environment
Surface: v0.8.1
LiveView: v0.17.11
Elixir: v1.14.0
Culprit
I tracked down the issue to the following line: https://github.com/surface-ui/surface/blob/b9675f9662f9d684ad4baeebdcc358ffab5264b2/lib/surface/compiler/eex_engine.ex#L1095-L1100
Since this looks like the context is intentionally set to an empty map, I decided not to attempt a PR for now.
Workaround
I built the component inclusion manually, for now, to work around the constraint / issue:
https://github.com/jshmrtn/hygeia/blob/c1debcb8c2652042ee1bf61b566ad2cb3e965ac7/lib/hygeia_web/templates/layout/live.sface#L2-L16