Skip to content

Fix Excel export crashing after Share / Save to My Harmony - #67

Merged
ronnyTodgers merged 1 commit into
masterfrom
fix/share-strips-instrument-refs
Sep 24, 2026
Merged

ronnyTodgers merged 1 commit into
masterfrom
fix/share-strips-instrument-refs

Conversation

@ronnyTodgers

Copy link
Copy Markdown
Collaborator

Reported by Thomas: the Excel export sometimes fails with Cannot read properties of undefined (reading 'name') at App.js downloadExcel (q.instrument.name).

Cause: prepForFireStore in DataContext.js removed the circular question.instrument reference with delete on the harmonisation's apiData. makePublicShareLink and saveToMyHarmony pass in the live React state (h.apiData = apiData), so after a share or save every question in the session lost its instrument. The next export then threw. Re-running the match rebuilds the references, which is why it looked sporadic. Match cards also lost their instrument names at the same point, because MatchUnit guards the missing value and prints nothing instead of crashing.

Fix: drop the reference while cloning for Firestore (a JSON.stringify replacer), the same way meta's harmonyFirestore.ts does. The live apiData is no longer mutated.

Verified:

  • A node script using the real simplifyApi and the old prepForFireStore reproduces the exact error after a share. With the new version, the export works.
  • The stored Firestore payload is byte-identical to before. Harmony's Question model has no instrument field of its own, only instrument_id / instrument_name.
  • CI=true npm run build and build:HarmonyExport pass.

🤖 Generated with Claude Code

prepForFireStore deleted question.instrument from the live apiData before
cloning it for Firestore, because makePublicShareLink and saveToMyHarmony
pass the state object straight in. After a share or save, every question
lost its instrument, so the next Excel export threw at q.instrument.name
(App.js downloadExcel) until the user re-ran the match. That made the
failure look sporadic.

Drop the reference while cloning instead, as meta's harmonyFirestore does.
The stored payload is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for harmony-staging ready!

Name Link
🔨 Latest commit 22352bc
🔍 Latest deploy log https://app.netlify.com/projects/harmony-staging/deploys/6ab529552ef8c8000884a07d
😎 Deploy Preview https://deploy-preview-67--harmony-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ronnyTodgers
ronnyTodgers merged commit 317aa70 into master Sep 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant