Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`Surface.View` can not access context

Aperta
#647 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
elixir
Ambito
backend

Direzione di ricerca

Start with lib/surface/compiler/eex_engine.ex around lines 1095-1100, identified as the culprit, and reproduce the issue using a Surface initialized with --layouts and context in live.sface or a used component. Done means the context value is read correctly instead of returning nil; the issue does not name a test to run.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 yields nil.

How to reproduce it

  1. Use surface initialized with --layouts
  2. Use context in live.sface or a component used by live.sface
  3. Resulting value will always be 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

Lingua principale
Elixir
Stelle
2.1k
Fork
146
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di surface-ui/surface

Tutte le issue di surface-ui/surface

Issue simili

Altre issue su Elixir

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.