-
Notifications
You must be signed in to change notification settings - Fork 819
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
Remove n^2 rendering problem with large symbol sets #235
Conversation
Thanks, @ianhook – this is SOO much faster! I've added a branch to test this on the demo repo that I created for #230: https://github.com/alampros/react-sketchapp-svg-render-test/tree/test-pull-235 |
examples/symbols/src/my-command.js
Outdated
@@ -6,54 +6,51 @@ import { | |||
View, | |||
Image, | |||
makeSymbol, | |||
injectSymbols, |
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.
Can this be removed safely? It's throwing an eslint error.
This error is thrown on render if
It looks like adding this check (from if (mastersNameRegistry === null) {
getExistingSymbols();
} |
src/symbol.js
Outdated
if (!notSymbolsPage) { | ||
notSymbolsPage = globalContext.document.addBlankPage(); | ||
} | ||
globalContext.document.setCurrentPage(notSymbolsPage); |
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.
shouldn't we store the current page at the beginning of the injectSymbols
method and go back to it instead of getting the first one here?
What's involved in getting this merged and released? |
@@ -28,6 +28,5 @@ module.exports = { | |||
View, | |||
Platform, | |||
makeSymbol, | |||
injectSymbols, |
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.
this is a breaking change. Could we maybe expose it again? (it's actually useful if you just want to generate the symbols without rendering anything as in #172 )
merged as part of #254 |
The original symbol code required
injectSymbols
to be called separately frommakeSymbols
becauseinjectSymbols
deletes the Symbols page and recreates it on every call. This can take a while as seen in #230.I put the
injectSymbols
call in the render method, because this is the only time it needs to be called.