-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: display errors in the Simple
component
#953
Conversation
Codecov Report
@@ Coverage Diff @@
## main #953 +/- ##
==========================================
- Coverage 63.19% 63.10% -0.09%
==========================================
Files 62 62
Lines 7930 7911 -19
Branches 1827 1826 -1
==========================================
- Hits 5011 4992 -19
Misses 2795 2795
Partials 124 124
Continue to review full report at Codecov.
|
Deploying with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
I tried running synthesizer-ui
locally (to compare this branch with main
) and had a couple questions:
- When I ran it on
main
, I got an error in Mutated Program #5, but when I ran it on this branch, the error was instead in Mutated Program #4. Is the synthesizer nondeterministic? - For the diagrams that don't error, I can click anywhere on the box to see the mutation overlay, but for the diagrams that do error, this only works if i click above the bottom of the error message. Could you change it so that errored diagrams let you click anywhere on the box to see the mutation overlay?
*/ | ||
const tex2svg = memoize( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify why you removed this memoize
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, #535 noted this issue, but there's no PR that fixes it. This fix doesn't close the issue though, because when downloading the SVGs (which is currently broken in Edgeworth, to be addressed in another PR) the labels still disappear.
Yes, I pass in a randomized seed to the synthesizer, which is the expected behavior of this GUI, as users expect different diagrams every time they hit
Correct. I finally learned that flexbox and |
Makes sense, thanks! |
Description
Related issue/PR: #535, #671
Simple
is a raw canvas for Penrose-generated diagrams. In the past iterations, the component didn't handle errors and rendered a blank canvas. In this PR, wheneverSimple
encounters an error, it renders the pretty-printed error message directly on canvas.Implementation strategy and design decisions
memoize
fromCollectLabels
error
in the state ofSimple
. This is mostly to let React handle re-rendering, which is a different case frompenroseState
(?)browser-ui
Simple
(see below)Examples with steps to reproduce them
In
synthesizer-ui
, I changedGridbox
so it's just a wrapper aroundSimple
, a few minor notes:Gridbox
has an overlay for mutation info and used to conditionally render the Penrose diagram whenever the user toggles the overlay. When using<Simple>
, this can be very slow because re-rendering will also run the Penrose optimizer. Instead, I always keep<Simple>
in the parentdiv
, and only stack the infodiv
on top of it once toggled.Checklist
diagrams/
folderOpen questions
Questions that require more discussion or to be addressed in future development: