Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Upload Bundle can send a bundle built before the latest playground edits

Open
#1,755 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
frontend, testing

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

Area: Playground Bug Difficulty: Low Priority: Medium

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

  1. Log in to an instance through the actions menu, then set Refresh Interval to 30000 in User Settings.
  2. Change details.title in index.ts.
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DouglasNeuroInformatics/OpenDataCapture

All issues in DouglasNeuroInformatics/OpenDataCapture

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.