-
Notifications
You must be signed in to change notification settings - Fork 113
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
[KED-2355] Update SVG-Crowbar to fix errors #339
Conversation
SVG-Crowbar v0.6.3 fixes a CORS issue that we were facing, so we can revert the fix in #337. However v0.6.2 seems to have introduced a new issue with PNG exports, so we cannot merge this change yet until it's fixed.
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.
Thanks for the quick fix!
@studioswong Thanks, but this isn't fixed yet, due to the new bug in SVG-Crowbar ~v0.6.2! We won't be able to update it to merge this PR and properly resolve this issue until that bug is fixed. Hence this is just a draft PR, and I'm gonna leave it here for when I pick this back up after xmas. |
v0.6.2 introduced [a call stack size error](cy6erskunk/svg-crowbar#278) when exporting PNGs, which was resolved in v0.6.4. However, v0.6.4 introduced [an issue with PNG cropping](cy6erskunk/svg-crowbar#75) that has been resolved in 0.6.5.
If the graph doesn't exist and graphSize is empty, which can happen if the graph is still loading/rendering, or if all the filters are applied, then NaN console errors will be thrown. This commit prevents these errors.
Thanks for the fix @richardwestenra , and great work for keeping a close eye and enduring all the SVG crowbar saga 👍 I just checked out the branch and both exports (SVG and PNG) works well 👍 Tried exporting the graph with all filters applied, while the export works fine ( it just exports an empty image with your theme background), I noticed that the console still throws errors for Perhaps we might even need to rethink about those situations with the empty flowchart, perhaps we might even grey out the export function given these type of situations there is no graph? All in all, thanks for the work! |
let height = graphSize.height + graphSize.marginy * 2; | ||
clone.setAttribute('viewBox', `0 0 ${width} ${height}`); | ||
let width, height; | ||
const hasGraph = graphSize.width && graphSize.height; |
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.
We might need to add the checks for valid values of width
and height
to eliminate those console errors?
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.
good point! fixed 👍
if (hasGraph) { | ||
clone.setAttribute('width', width); | ||
clone.setAttribute('height', height); | ||
} |
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.
it might be worth to rethink about the else
scenerio for the empty flowchart - we could perhaps apply a standard width
and height
in the meantime for the sake of allowing us to still export and empty graph while we look into the flow when exporting an empty graph?
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.
I think it works as is without needing an explict height - I don't think we need to think any more about this extreme edge case. I tidied up the console errors for the sake of completeness as I don't like exposing uncaught errors, but I don't think it needs anything else tbh.
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.
sure thing, just tested and the errors are gone, so if it works without the need to manually specify a width and height then it's all good.
# Release 3.9.0 ## Major features and improvements - Add code panel (#346) - Improve view panning behaviour when a node is selected (#356, #363, #370, #373, #374) - Improve layout performance for large graphs (#343) - Save tag state to localStorage (#353) ## Bug fixes and other changes - Improve graph layout code quality, performance and docs (#347) - Update docs to remind on compatibility of Kedro-Viz 3.8.0 with Kedro 0.17 (#367) - Update dependencies (#360, #364, #369) - Fix failing CircleCI build on Windows (#365, #366) - Refactor node-list-row CSS, fixing hover and focus states (#355, #358, #362) - Update iconography (#357, #359) - Fix missing indicator Chrome zoom bug (#349) - Fix sidebar border/box-shadow CSS rules (#351) - Fix server.py to work with versions >0.17 and update contributing docs (#348) - Fix errors when scrolling with empty pipeline (#342) - Ignore coverage on some branches and fix e2e tests (#345) - Fix icon-button tooltips on mobile (#344) - Update SVG-Crowbar to fix errors (#339) - Update contributing docs for new dev server (#341)
Description
We were originally using SVG-Crowbar v0.6.0, but started experiencing a critical CORS error with internal CSS in exported images, which was patched in #337. This PR updates the dependency version and reverts the patch.
Development notes
SVG-Crowbar v0.6.3 fixes the CORS issue, so we can revert the fix in #337.
However v0.6.2 introduced a call stack size error when exporting PNGs, which was resolved in v0.6.4.
However, v0.6.4 introduced an issue with PNG cropping that has been resolved in 0.6.5.
So in summary, we have now updated to v0.6.5 now that all of these errors have been resolved.
I've also added a small fix for console errors when exporting a null graph. If the graph doesn't exist and graphSize is empty, which can happen if the graph is still loading/rendering, or if all the filters are applied, then NaN console errors will be thrown. This commit prevents these errors.
QA notes
You will need to update/install the SVG-Crowbar dependency to test this fix.
Checklist
RELEASE.md
fileLegal notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":
I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorised to submit this contribution on behalf of the original creator(s) or their licensees.
I certify that the use of this contribution as authorised by the Apache 2.0 license does not violate the intellectual property rights of anyone else.