ekzhang / percival

📝 Web-based, reactive Datalog notebooks for data analysis and visualization
https://percival.ink
MIT License
604 stars 25 forks source link

code cell with syntax error gets erased on toggle #11

Closed namin closed 2 years ago

namin commented 2 years ago

Steps to reproduce:

  1. Create a code cell.
  2. Write invalid code, such as: 1, 2, 3. The code block is highlighted in orange.
  3. Click the down arrow to toggle the visibility of the code block, rendering it not visible.
  4. Click the right arrow to toggle visibility of the code block, rendering it visible.
  5. The code block is empty, while expected to contain 1, 2, 3.
ekzhang commented 2 years ago

Hi, I believe the confusion here is the orange color. Actually, the orange highlight is not a syntax error - it simply means that the code was changed and not yet saved / run. You need to run a code cell with Shift+Enter before it is saved. See the two images below, before and after pressing Shift+Enter.

image

image

However, I agree that it is not desirable behavior for the editor's contents to be reset when the code visibility gets toggled.