Closed chpill closed 7 years ago
I'm not sure why it is a problem to have it return an error. Right now the frontend decides to hide the editor if an error is returned by read-file
. Is it causing any problem UX-wise?
Not really. I dug into this at first because i was wondering why i could not click anywhere on a directory node to open/close it (which is in fact the standard behaviour of the react material ui lib for selectable-lists). When I saw this error I ran with it but realized later it had nothing to do with the first issue...
I guess having http errors when navigating files / directories is okay, but one thing that could trip up developers is that when the .nightlight.edn
file is saved with a directory path as selection, every refresh of the page will trigger this same error. Something to keep in mind.
I'll look into validating .nightlight.edn
better.
Clicking on file node in the side bar triggers a
POST /write-state
and aPOST /read-file
, and then displays the file in the editor which is good.Unfortunately, when clicking on a directory node (anywhere else but the button), it also triggers those 2 requests. The
POST /read-file
immediately fails with a400
. ThePOST /write-state
succeeds, and stores the in the:selection
a path that cannot be displayed in the editor (thus, when reloading the page, it will trigger again the faultyPOST /read-file
.I guess there are 2 separate concerns here. First clicking anywhere on the directory node in the side-bar should trigger the fold/unfold behavior (limited to the button right now). Second, the server (maybe also the client) should validate the data before writing the
.nightlight.edn
file.Anyway, thanks a lot for this awesome editor! I'll try to use it to teach people clojure and it's interactive way of programming.