html-sketchapp: Crash when editing text after importing `.asketch` file

Tried using this project to experiment both with a fork of https://github.com/brainly/html-sketchapp-example/ and this branch of seek-style-guide.

For both those projects, I was able to reproduce crashes with these steps:

  1. Import an asketch file with some text values
  2. Try to either edit a generated text layer or a new text layer
  3. Sketch crashes

Was able to reproduce in both Sketch stable and beta.

Sketch Stable (47.1) Error Log

Error log linked in this gist

Sketch Beta (48) Error Log

Error log linked in this gist

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 28 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I do not know why, but this bug follows the last modified layer.

As far as I understand Sketch keeps last used text settings in ${HOME}/Library/Application Support/com.bohemiancoding.sketch3/textStyle-*. Just remove the file when you need to fix editing.

It seems that the undefined line height and letter spacing values are being turned into nulls at some point.

I double checked the code and don’t see where this can be happening 🤔 Hope you’ll be able to debug it @markdalgleish 🤞

By the way, could we re-open the issue?

Done.

Still working through this, but figured I’d report my progress so far.

It seems that the undefined line height and letter spacing values are being turned into nulls at some point. If I change the following line in nodeToSketchLayers.js:

lineHeight: lineHeight !== 'normal' ? parseInt(lineHeight, 10) : undefined,

to this:

lineHeight: lineHeight !== 'normal' ? parseInt(lineHeight, 10) : '12345',

I can see the 12345 value flow through to the JSON instead of null.

I’m currently debugging Puppeteer and logging the element whenever the value is normal, and they all appear to be buttons and inputs, so just digging into that next.

@KimDal-hyeong Bravo!

@markdalgleish I just merged the PR, can you please confirm that it fixes the issue?

BTW I’ve also found a simpler way of “fixing” Sketch after it breaks:

rm "${HOME}/Library/Application Support/com.bohemiancoding.sketch3/textStyle-*"

Which also points to the text styles being the issue.

Thanks for reporting it and creating a test case!

I don’t see such bugs reported in react-sketchapp, so I’m guessing that html-sketchapp is doing something wrong 😕

I’m able to freeze sketch just by opening your file and trying to change text on any of the text layers. To simplify debugging I’ve created a minimal example (no document colors & shared styles, no user settings, and only one symbol consisting of only text layer): minimal.sketch. sketch-frozen mov

(text looks weird because I don’t have your fonts installed locally)

We can try to narrow it down even more and figure out what html-sketchapp might be doing wrong. If that fails, we should contact Sketch devs. I’ll try to take another look this week, but I’ll appreciate any help.

I’ve seen this as well @markdalgleish; the only way for me to fix this is to open up an existing Sketch file that was created before the import of the asketch file and copy a text element from there.

(@markdalgleish updated issue to have error logs in linked gists)