Repository navigation
fix: parse comparison file with parseAsync - #35
Merged
Merged
Conversation
LayerComparison.loadCompareFile called p.parse(), which GcodeParser does not have, so loading a compare file threw in FileReader.onload and the callback never ran. Await parseAsync before invoking the callback.
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.
Summary
Loading a comparison file (Compare File button) never worked:
LayerComparison.loadCompareFilecalledp.parse(...), butGcodeParseronly hasparseAsync. The call threw insideFileReader.onload, so the callback that shows the toast, updates the diff stats and re-renders never ran.src/comparison.js: theonloadhandler is nowasyncand awaitsp.parseAsync(text, file.name)before settingcompareParserand calling the callback.LayerComparisonis also exported so it can be tested;build.jsstrips theexport.test/comparison.test.js: new. It runsloadCompareFilewith a fakeFileReaderand thefibreseeker_mini.gcodefixture, and checks the callback receives a parsed parser with layers and thatgetCompareMovesreturns moves. I watched it fail first withp.parse is not a function.gcode-modifier.html: rebuilt, as in earlier fix commits.This bug was already on
mainand is unrelated to #34 (the Vortek HUD), which is why it is a separate branch.Test plan
npm test: 378 of 378p.parse is not a function) and passes after