Skip to content
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

Symbols are not rendering #351

Closed
thecalvinchan opened this issue Jun 7, 2018 · 5 comments · Fixed by #353
Closed

Symbols are not rendering #351

thecalvinchan opened this issue Jun 7, 2018 · 5 comments · Fixed by #353

Comments

@thecalvinchan
Copy link
Contributor

| -------------------------------------------------------------------------------------------------

Reporting a bug or issue

Expected behavior:

The react-sketchapp/examples/symbols project renders properly

Observed behavior:

It reports an error

/Users/calvinchan/react-sketchapp/examples/symbols  [git:master][calvinchan@ip-10-1-1-107] [15:03]
> yarn render
yarn run v1.6.0
$ skpm-build --watch --run
🖨  Copied src/manifest.json in 9ms
Error: Cannot render into Symbols page
line: 3109
sourceURL: /Users/calvinchan/react-sketchapp/examples/symbols/symbols.sketchplugin/Contents/Sketch/my-command.js
column: 16
stack: render@/Users/calvinchan/react-sketchapp/examples/symbols/symbols.sketchplugin/Contents/Sketch/my-command.js:3109:16
/Users/calvinchan/react-sketchapp/examples/symbols/symbols.sketchplugin/Contents/Sketch/my-command.js:4629:30
__skpm_run@/Users/calvinchan/react-sketchapp/examples/symbols/symbols.sketchplugin/Contents/Sketch/my-command.js:33077:17
__skpm_run@[native code]
🔩  Built ./my-command.js in 3249ms

How to reproduce:

clone repository and run yarn render

(on yarn 1.6)

Sketch version:

50.2

Please attach screenshots, a zip file of your project, and/or a link to your github project

@thecalvinchan
Copy link
Contributor Author

looks like this issue occurs with v2.0.0 on npm, and not 1.1.0

@jaridmargolin
Copy link
Collaborator

Hi @thecalvinchan - Thanks for the report. I have reproduced the issue.

There are actually a few issues here:

  1. The example attempts to render a Document into a Page. This should be removed from the example code.
  2. The error is caused by rendering the Document into the Page, however it somehow doesn't get caught until Error: Cannot render into Symbols page. This should Error should get caught earlier in the render cycle, and thrown with an appropriate error message.

@thecalvinchan
Copy link
Contributor Author

@jaridmargolin I don't think that the example is trying to render a Document (as defined by react-sketchapp) in the page. The default export defines a const Document that is just an Artboard. That document is rendered into the page.

Furthermore, 1.1.0 symbol overrides are not working as expected

@jaridmargolin
Copy link
Collaborator

@thecalvinchan - You are 100% right. How foolish of me to think a const named Document would refer to a Document 😂

In all honesty, this makes much more sense now. The Error is getting caught in the correct location. The error appears to be due to the fact that makeSymbol results in switching the current page.

I just created a small patch, #353, that should work around this issue.

jaridmargolin added a commit that referenced this issue Jun 10, 2018
Ensure `makeSymbol` does not change currentPage (closes #351)
@jaridmargolin jaridmargolin reopened this Jun 21, 2018
@mathieudutour
Copy link
Collaborator

published in 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants