Playground static-assets example throws ReferenceError on Submit because message is undefined, hidden by another example's ambient global
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
Línea de trabajo
Empieza con apps/playground/src/instruments/examples/interactive/Interactive-With-Static-Assets/index.ts y su fragment.html; compara el controlador Submit con la validationSchema del ejemplo. Lee también Interactive-With-Legacy-Script/legacy.d.ts para entender por qué la comprobación de tipos no detecta el identificador indefinido. Añade una comprobación de extremo a extremo en testing/src/specs/playground.spec.ts; se considera terminado cuando al enviar este ejemplo se completa correctamente con un mensaje válido.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The playground's "Interactive Instrument with Static Assets" example can never be completed. Its Submit handler calls done({ message }), but nothing in the instrument defines message, so clicking Submit throws ReferenceError: message is not defined and done is never called. Type-checking does not catch it, because a different example, Interactive-With-Legacy-Script/legacy.d.ts, declares declare let message: 'hello' as an ambient global. That declaration is in scope for every file under apps/playground/src, so tsc (and pnpm lint) accept the undefined identifier.
Where
apps/playground/src/instruments/examples/interactive/Interactive-With-Static-Assets/index.ts:18-23:
render(done) {
const button = document.getElementById('submit-btn')!;
button.addEventListener('click', () => {
done({ message });
});
},
The global that hides it, apps/playground/src/instruments/examples/interactive/Interactive-With-Legacy-Script/legacy.d.ts:1:
declare let message: 'hello';
fragment.html has no element with id="message" either, so no named-element global exists at runtime.
Reproduce
- Open the playground and select Examples → Interactive Instrument with Static Assets.
- Click Submit in the preview.
Actual: the browser console shows ReferenceError: message is not defined, and the instrument never completes.
Expected: the instrument completes with a message string that satisfies its validationSchema.
Tests
The playground's vitest project only covers pure modules, so the e2e test is the guard: in testing/src/specs/playground.spec.ts, select this example, click Submit in the preview frame, and assert that the instrument reaches its completed state.
Suggested fix
Pass a literal, e.g. done({ message: 'Hello' }). Then scope the legacy example's ambient declaration so it cannot mask undefined identifiers in other examples, for example by declaring it as window.message (declare global { interface Window { message: 'hello' } }) and reading it as window.message in that example.
- Lenguaje dominante
- TypeScript
- Estrellas
- 119
- Forks
- 19
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 56
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DouglasNeuroInformatics/OpenDataCapture
-
Area: Instruments Bug Difficulty: Low Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Los mantenedores suelen responder en 1 día
-
Area: Outreach Bug Difficulty: Low Priority: Medium Security
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
DouglasNeuroInformatics/OpenDataCapture#1791 ·
Los mantenedores suelen responder en 1 día
Todos los issues de DouglasNeuroInformatics/OpenDataCapture
Issues similares
-
bug priority:low ready-for-dev
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Automattic/data-liberation-agent#685 ·
Los mantenedores suelen responder en 1 día
-
Business
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
txn2/mcp-data-platform#2063 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 77/100
Crosstalk-Solutions/project-nomad#1427 ·
Los mantenedores suelen responder en 2 días