Fix Excel export crashing after Share / Save to My Harmony - #67
Merged
Merged
Conversation
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>
✅ Deploy Preview for harmony-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported by Thomas: the Excel export sometimes fails with
Cannot read properties of undefined (reading 'name')atApp.jsdownloadExcel(q.instrument.name).Cause:
prepForFireStoreinDataContext.jsremoved the circularquestion.instrumentreference withdeleteon the harmonisation'sapiData.makePublicShareLinkandsaveToMyHarmonypass 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, becauseMatchUnitguards the missing value and prints nothing instead of crashing.Fix: drop the reference while cloning for Firestore (a
JSON.stringifyreplacer), the same way meta'sharmonyFirestore.tsdoes. The liveapiDatais no longer mutated.Verified:
simplifyApiand the oldprepForFireStorereproduces the exact error after a share. With the new version, the export works.Questionmodel has noinstrumentfield of its own, onlyinstrument_id/instrument_name.CI=true npm run buildandbuild:HarmonyExportpass.🤖 Generated with Claude Code