-
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
fix: Docs-site Shape Property page errors and crashes #1045
Conversation
This file contains 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
cmumatt
changed the title
Update shape component to work w/new style context
fix: Update shape component to work w/new style context
Jun 5, 2022
Codecov Report
@@ Coverage Diff @@
## main #1045 +/- ##
=======================================
Coverage 63.48% 63.48%
=======================================
Files 59 59
Lines 7115 7115
Branches 1583 1583
=======================================
Hits 4517 4517
Misses 2502 2502
Partials 96 96
Continue to review full report at Codecov.
|
Deploying with Cloudflare Pages
|
cmumatt
changed the title
fix: Update shape component to work w/new style context
fix: Docs-site Shape Property page errors and crashes
Jun 7, 2022
joshsunshine
approved these changes
Jun 7, 2022
Looks good to me. I think it's ready to merge. |
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.
Description
Resolves issue #1044 plus others (see below).
The
ShapeProps
React component indocs-site
previously pulled shape data fromShapeDef
in@penrose/core
by creating shapes on a canvas and inspecting their properties at runtime. With the Style compiler re-write, instantiating shapes requires passing aContext
object. As a JS React component,ShapeProps
lacked type checking and this component was never updated to work with the new compiler. This caused all shape documentation pages to crash in production.This PR replaces the former JS React
ShapeProps
component with a TS component of the same name that imports a JSON file of shape properties calculated at build time rather than calling into@penrose/core
to create and evaluate shapes at runtime.This PR also fixes some additional issues that weren't previously logged as issues:
ColorV
values were inaccurately rendered on the page.PointV
values were inaccurately rendered on the page.ShapeProps
component would hang the UI when first accessed if theDemo
component were accessed prior.Docs-site
build was extremely slow when both theShapeProps
andDemo
components were active.ShapeProps
component lacked any type checking, which lead to issue Shape documentation pages are crashing #1044, and others.ShapeProps
component would not compile on the server side; previously a workaround was in place to force it to compile in the browser at runtime. This workaround is no longer necessary.Implementation strategy and design decisions
automator
command,shapedefs
, which outputs a JSON file of all shapes and their properties, including which properties are sampled and which properties are defaulted.ShapeProps
component imports this data during build to render the shape properties pages server side.@penrose/core
and instantiate shapes dynamically at runtime withinShapeProps
.ShapeProps
component is converted to TypeScript to allow type-checking. Type checking would have prevented the original issue Shape documentation pages are crashing #1044 and others.Checklist
diagrams/
folderOpen questions