Upload Bundle can send a bundle built before the latest playground edits
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
Research direction
Start with UploadBundleDialog.tsx to trace how the current bundle is selected, then read Viewer.tsx to understand when files are rebuilt. Add the files-hash comparison and test it in apps/playground/src/utils/__tests__/file.test.ts; the issue also specifies an E2E test in testing/src/specs/playground.spec.ts. Done means an immediate upload after editing posts a bundle containing the latest title, with the helper test passing.
Written by the indexing model from the issue text.
Description
Upload Bundle can send an ODC instance a bundle built before the user's latest edits, and report success. UploadBundleDialog uploads transpilerState.bundle whenever the state is built. The Viewer rebuilds only on its polling tick, every settings.refreshInterval milliseconds (2000 by default, and user-configurable in User Settings). The built state does not record which files it was built from. So between an edit and the next tick, the state is still built from the previous files, and an upload in that window posts the old code. The dialog says nothing about this. With a longer refresh interval, the window is that long.
Where
apps/playground/src/components/Header/ActionsDropdown/UploadBundleDialog.tsx:57-92:
const handleSubmit = async () => {
const state = transpilerStateRef.current;
if (editorErrors.length > 0) {
// ...
} else if (state.status === 'building' || state.status === 'initial') {
// ...
}
// ...
const bundle = state.bundle;
apps/playground/src/components/Viewer/Viewer.tsx:64-73:
useInterval(() => {
const currentFiles = editorFilesRef.current;
hashFiles(currentFiles)
.then((currentHash) => {
if (currentHash !== filesHash) {
void transpile(currentFiles);
}
})
.catch(console.error);
}, refreshInterval);
Reproduce
- Log in to an instance through the actions menu, then set Refresh Interval to
30000in User Settings. - Change
details.titleinindex.ts. - Within 30 seconds, open the actions menu, choose Upload Bundle and click Upload.
Actual: the instance stores the instrument with the old title, and the playground shows a success notification.
Expected: the upload uses a bundle built from the files currently in the editor, either by building them first or by refusing with a "build in progress" message.
Tests
Store the files hash on the built state and add a pure helper that compares it with the current files. Test the helper in apps/playground/src/utils/__tests__/file.test.ts: it('should treat a bundle built from other files as stale, so an upload never sends code older than the editor').
E2E in testing/src/specs/playground.spec.ts: intercept POST **/v1/instruments with page.route, edit the title, upload straight away, and assert that the posted bundle contains the new title.
Suggested fix
Record the files hash in the built state ({ status: 'built', bundle, filesHash }). In handleSubmit, hash useAppStore.getState().files, and if it differs from filesHash, build those files and upload the result (or refuse with a message).
- 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: Playground Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Maintainers usually reply within 1 day
-
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
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
siyuan-note/siyuan#20313 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
alunduil/projects-v2-sync#14 ·
-
Service process inherits the caller's cwd at first use, holding that folder open on Windows (EBUSY)Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
DevTools page styles leak into the host app in developmentPossibly taken @onmax claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nuxt-modules/better-auth#567 · 1 comment ·
Maintainers usually reply within 1 day