thanks for reporting @nanaosakisan! can you be more specific about how to reproduce this bug? for example, by listing out a few steps? i don't understand what the bug is.
I can't tell you step by step how to reproduce the bug. If I change my code (like add a variable named "test" for example), and save the change, when I want to run the program, an error notify appears and tells me that the variable "tes" doesn't exist. If I refresh the page, I can see that the variable I created before is named "tes", so not correctly.
If I don't save the change, the bug doesn't appear.
Télécharger Outlook pour Androidhttps://aka.ms/ghei36
De : Cassie Tarakajian
Envoyé : lundi 17 décembre à 20:08
Objet : Re: [processing/p5.js-web-editor] Save/refresh issue (#790)
À : processing/p5.js-web-editor
Cc : nanaosakisan, Mention
thanks for reporting @nanaosakisanhttps://github.com/nanaosakisan! can you be more specific about how to reproduce this bug? for example, by listing out a few steps? i don't understand what the bug is.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/processing/p5.js-web-editor/issues/790#issuecomment-447961820, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcZQcmoXuc2cPw-5DyUETBB07HQsdoXMks5u5-uQgaJpZM4ZWa5g.
I have noticed some odd behavior like this after the fix for #675 was published. I think this may be related? I meant to file this a few days ago, but I forgot. You can see the trouble I was having here:
https://youtu.be/pKyU92cza0Y?t=1978
I will investigate a bit more!
I encountered this bug again this morning. I still cannot determine what exactly is causing it and I don't see anything in the console output. But in case this is helpful, here is the sketch:
https://editor.p5js.org/codingtrain/sketches/SJMl3u5xN
This is what I am doing:
add() to push().Uncaught TypeError: next.add is not a functionadd().(Update I restarted browser and was able to save the change)
thanks for the updates! i'm going to dig into this.
i think what's happening here is inconsistency between what's in the editor, what's in the redux store, and what's on the server. when a sketch is saving, and then a user changes the editor, i think it's not getting into sync properly, and maybe the change i made is just exposing this.
update: i'm having a hard time consistently being able to reproduce this. i'll keep looking at this and hopefully figure it out soon 😕
I taught a workshop and ran into this issue a few times with attendees. I unfortunately noticed that from time to time it also does not render the code in the editor but from the last save (I think). Very mysterious! I am able to reproduce it more consistently with auto-save on, I recorded a screen capture here:
Note at 46 seconds it renders background(100) while the code itself has background(220).
The video starts with autosave off and it's interesting to note that when I refresh the page you'll see the old code for a brief moment before the newly saved code replaces it.
Hope this is a bit helpful! I am happy to look into this more if anyone has suggestions for tests I can run!
thanks @shiffman—hopefully i'll figure out how to reproduce this!
I'm helping @REAS teach a class right now and we've had multiple students also encountering this issue (8+ within the past hour). They've reported saving (sometimes multiple times) over a duration only to have the code revert to an earlier version. This has happened to me as well; I'm having a hard time reproducing it consistently, but the behavior is very similar to what @shiffman has experienced in his screen captures. I'll update if I can find a reliable test case.
I am seeing a version of this a lot over the last several days.
The symptom for me is that in the middle of writing code (or possibly also when running code), the source code in my editor pane instantly reverts to an older version, wiping out whatever changes I made in the last X minutes.
If I had that latest code running in the preview pane when this happens—and I didn't have auto-refresh turned on—then I am able to inspect the canvas (using browser dev tools) and find the most recent version of the script there so I can copy and paste it back into the editor pane. But if I had auto-refresh on, this swapping out of new code for old also changes what's in the DOM so my inspect trick doesn't work.
My suspicion is that when this code reversion happens, it is triggered when an auto-save happens, so I've turned off auto-save for the moment to see if I'm right. Will report back if I learn more. Happy to try and help further if I can—this is starting to feel regular to me (I've had it happen maybe 8 times in the last 3 or 4 days).
update--> Unfortunately, turning off auto-save isn't a useful workaround. I've had it off for the last hour and just had my code reverted.
@shiffman @catarak I think I figured out how to recreate the bug consistently here are the steps (maybe won't work on your pc) - Auto-refresh is off
NOTE : i suspect that timing is really important in here, and i think this bug is causing differently on different Internet Speeds and throttles
Project Saved and Autosave enabled message then -background(0) value and Savebackground(100) value hit Save and then reload (ctrl+r) while the Project Saved alert is visible on screen.A bump on this issue and a related question. I now have my students back working locally in Brackets instead of using editor.p5js.org until we have a reliable workaround for the issue discussed in this thread, but not being able to use the online editor for in-class experimentation _really_ slows down the pacing of an already packed-to-the-gills course!
Which brings me to my related question: Does anyone know of another online editor that we could use with P5.js in the meantime? I tried to set up a project in JSFiddle, but the way that it sandboxes code appears to be incompatible with P5's "magic functions" (that's what I call setup(), draw(), etc. with my students).
As a small follow up, I've found that disabling Autosave does not resolve this issue.
@jaytay579 I haven't tested it in a class setting, but it may be worth trying Codepen. Here's a template:
https://codepen.io/L05/pen/KJREpO?editors=0010#0
Being a VS code fan @L05 i've been trying out blitzStack
Still I;m lucky that I've not see this problem in the p5.editor
As far as using p5 in JSFiddle, I found this demo:
https://jsfiddle.net/SamyBencherif/5xuxrwpu/
Not sure about how it sandboxes. Looks like the magic functions work.
sorry for the slowness in getting to work on this—i've been out of town and away from my computer! this ticket is high priority and hopefully i will have a fix soon, within the next week or so.
spent some time looking at this! i think there's a couple things going on here, but i _think_ at least merging #838 fixed one of the issues. another one is the delay in propagating data between CodeMirror (the library that this project uses for the editor) and Redux (the front-end state manager). i'm going to work on some changes for the latter, but keep me updated if you've noticed any improvements from #838 being merged.
Thank you for the update! Will do.
just merged some commits that should fix the scenario described by @anuraghazra (will take a few minutes to deploy), would be great to get some testing!
Woohoo! I'll do some serious testing of this tomorrow during class! Thank you @catarak! 🥇
I have not seen this bug for a while (the last week?), so it certainly
appears your efforts are working out for me. Will continue to watch for it.
Thanks!
On Mon, Feb 25, 2019 at 3:47 PM Daniel Shiffman notifications@github.com
wrote:
Woohoo! I'll do some serious testing of this tomorrow during class! Thank
you @catarak https://github.com/catarak! 🥇—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/processing/p5.js-web-editor/issues/790#issuecomment-467196651,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAxrDcHRrjR5ARlBLG7I7L-NYArl3s4rks5vRFn5gaJpZM4ZWa5g
.
I've recently experienced this bug similar to how Ben described it.
Working on a sketch and making multiple saves/rerunning, and then at some point when saving it reverts to a previous version.
I can't recreate it but in my case these have been projects created using the duplicate option, and they revert all the way back to the original duplication, before any changes were made.
i think the issue with duplicating reverting to an older version is a separate issue from the one i was focusing on. i'll do some investigation!
I had this bug happen to me twice in the last two days. I had auto-save and auto-refresh on. While moving some code around that was introducing errors into the console the editor reverted back to a save from hours ago. All current code is gone.
i'm sorry, that's really frustrating! could this maybe have to do with having the same sketch open in different windows?
I've also been experiencing this problem frequently over the past week: the online editor occasionally reverts back to an old version and recent work is lost. I've been using the duplicate option, and maybe that's the source of the bug. FWIW, I've had auto-save on, but not auto-refresh. Any updates would be great. Thanks!
it could have to do with duplicating too! i think some further investigation needs to be done. but thanks for all of the updates, it's really helpful.
i'm working on some changes for this as part of #1039—it hopefully fixes some of the synching issues! i haven't been able to reproduce any issues that come up with duplicate sketches, so i'm going to keep trying to figure that out.
I haven't had any issues recently, but I've also been avoiding any duplication... Huge thanks for looking into this. Hoping to prevent frustrations for students who are new to coding.
@rmacdonaldbeaver for sure! let me know if you notice anything weird. it's much easier for me to fix stuff if i have concrete steps to reproduce 😸
Thank you @catarak! I haven't been teaching with the Editor this quarter, so I haven't had the chance to notice the issue.
I've just experienced this issue or something very similar. I've been working on a project on and off for a few weeks, and today it's reverted back about a week (the open project window has the last change dated from 5 days ago and it appears nothing has saved after that point).
I have autosave on, auto-refresh off and often hit ctrl-S out of habit. I work with multiple sketch files and all have reverted inc. name changes. Sometimes I sleep & wake my laptop with the page still open and continue work.
I noticed when closing the tab last night I had something similar to #675 occur with an unsaved work warning dialogue. I remember cancelling the close operation, hitting ctrl-S (I can't recall if the dot disappeared or if there was a save project confirmation - but I think maybe the dot disappeared and the confirmation didn't occur), and thinking it must be saved. I went to close the tab again and had the same warning, but felt safe that it was actually saved given I had autosave on and had manually hit save.
Today, I was able to change a few characters in a file and the save appears to work as expected
I assume these files updates are now lost to time :( ?
i'm sorry this happened @cheriesdavidson! did you possibly have the sketch open in multiple tabs?
I'm going to close this just so folks will open a new issue if errors are coming up again! I think this will be fixed by some stuff discussed in #1337.
Most helpful comment
just merged some commits that should fix the scenario described by @anuraghazra (will take a few minutes to deploy), would be great to get some testing!