`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`

Abierto
#11,096 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@effect-bot ya está trabajando en esto.

Desde el 29/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

partially generated with help of my ai friend - neon 4.4

Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native

What version of Effect is running?
  • effect: 4.1.7
  • @effect/ui & @effect/ui-native: Effect-TS/ui main at 77391ee50ae3d3175d670facbf675e9a819ba6a6
  • react-native: 0.88.1
What steps can reproduce the bug?
  1. Clone the minimal reproduction repository:
    git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git
    cd effectui-native-error-reproductions
    pnpm install
    pnpm vitest run 10-controlled-input-restore-misses-commit
    
  2. Mount a controlled input with value = "12" and commit.
  3. Dispatch a native topChange event ({ text: "12a", eventCount: 1 }) whose edit is rejected by the model (so no component re-render occurs), wait for the setTimeout(..., 0) restore in NativeHost.ts, and inspect ui.completeRoot / ui.cloneNodeWithNewProps calls (see 10-controlled-input-restore-misses-commit/repro.test.ts).
What is the expected behavior?

After restoring the rejected edit on the controlled input, NativeHost should commit the dirty Fabric shadow node (ui.cloneNodeWithNewProps + ui.completeRoot) so text: "12" and mostRecentEventCount: 1 are flushed to the native shadow tree immediately.

What do you see instead?

ui.completeRoot is called 0 times and ui.cloneNodeWithNewProps is never called.

In packages/ui-native/src/NativeHost.ts:545-550:

// After the microtask render, restore rejected controlled edits if still mounted.
if (handle.value !== undefined) {
  setTimeout(() => {
    if (mounted(handle)) setProp(handle, "value", handle.value)
  }, 0)
}

setProp(handle, "value", handle.value) calls setText (packages/ui-native/src/internal/kinds.ts:122-129), which calls host.set(n, "text", value) and host.set(n, "mostRecentEventCount", n.eventCount) (marking n.dirty = true) and dispatches setTextAndSelection, but host.commit() is never called. The updated text and mostRecentEventCount shadow props stay stranded uncommitted until some unrelated future render flushes the tree.

Additional information

Calling commit() inside the setTimeout callback in NativeHost.ts:547-550 after setProp(handle, "value", handle.value) ensures both the imperative setTextAndSelection command and the Fabric shadow props stay synchronized.

Lenguaje dominante
TypeScript
Estrellas
16.7k
Forks
808
Merge medio
21 h 22 min
PR fusionados (30 d)
486

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Effect-TS/effect

Todos los issues de Effect-TS/effect

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.