Playground static-assets example throws ReferenceError on Submit because message is undefined, hidden by another example's ambient global
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
Research direction
Start with apps/playground/src/instruments/examples/interactive/Interactive-With-Static-Assets/index.ts and its fragment.html; compare the Submit handler with the example’s validationSchema. Also read Interactive-With-Legacy-Script/legacy.d.ts to understand why type-checking misses the undefined identifier. Add an end-to-end check in testing/src/specs/playground.spec.ts; done means submitting this example completes successfully with a valid message.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 19
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 56
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DouglasNeuroInformatics/OpenDataCapture
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Maintainers usually reply within 1 day
-
Area: Outreach Bug Difficulty: Low Priority: Medium Security
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
DouglasNeuroInformatics/OpenDataCapture#1791 ·
Maintainers usually reply within 1 day
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
[bug] diagnostics.dumpBody:Buffer 形态请求(透传 lane)跳过 dumps/ 落盘,仅留 raw/-unknown-Possibly taken @ranxianglei claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ranxianglei/billion-context#2421 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
platformatic/mcp#216 ·
Maintainers usually reply within 1 day
-
pending triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nuxt/test-utils#1842 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MoonshotAI/kimi-code#4146 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
farbenmeer/tapi#531 ·