Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Form update uses incorrect target on reconnect

Offen
#551 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
30/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
elixir
Bereich
backend

Rechercherichtung

Start by creating the simplified reproducible project described in the issue, using Surface v0.6.1, LiveView v0.16.4, and the shown component hierarchy. Trace reconnect handling and the handle_event/3 target resolution while the tab is backgrounded; done means reconnecting no longer repeatedly calls MyLiveComponent.handle_event/3 instead of the LiveView handler.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

I have a component hierarchy that looks something like this:

MyLiveView
  -> MyLiveComponent
    -> MyFormComponent
      -> <Surface.Components.Form change={"update", target: :live_view} ... />

This works great on the golden path, handle_event/3 is called on the LiveView as expected.

However, if the tab has to reconnect to my app while the tab is in the background, such as in the following scenarios:

  1. Put the tab in the background (i.e. open some other tab as the active tab)
  2. Restart the server

or

  1. Put the tab in the background (i.e. open some other tab as the active tab)
  2. Close computer (goes to sleep)
  3. Open computer later

My app tab (which is not the active tab in Chrome) will reconnect and attempt to call handle_event on MyLiveComponent instead of on MyLiveView, over and over again, indefinitely.

The (redacted) error I see in my console is:

** (UndefinedFunctionError) function MyLiveComponent.handle_event/3 is undefined or private

If I then click on the tab and make it the active tab, it seems to do something slightly different and is able to re-establish the correct target and figure it out.

I wasn't sure if this was a dev-only issue, but I recently launched to the public and found that it indeed affects production as well, as AppSignal is showing 1,800 errors per hour, per user.

I'm going to work on making a simplified, reproducible project once I have a minute, but I'm not familiar with the internals of Surface or LiveView and wondered if anyone had any feedback on where I might start looking for the problem, or a workaround.

Surface: v0.6.1
LiveView: v0.16.4
Elixir: v1.12.2
Chrome: 96.0.4664.110

Vorherrschende Sprache
Elixir
Sterne
2.1k
Forks
146
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus surface-ui/surface

Alle Issues in surface-ui/surface

Ähnliche Issues

Weitere Issues zu Elixir

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.