razetime / APLgolf

A HTML frontend to make code golfing in APL easier and more convenient.
https://razetime.github.io/APLgolf
6 stars 1 forks source link

Preserve options on reload #6

Closed sloorush closed 1 year ago

sloorush commented 1 year ago

I am not sure how you are storing the options, but preserving those options in the browser memory(local storage or cookies) can be an easy quality-of-life enhancement that would benefit the users.

razetime commented 1 year ago

the options are stored in the URL, which is a permalink that restores the options. Adding local storage would mess with any other permalinks, and since this is static, I cannot track tab sessions for restoring data. If you have any ideas how to do this without hurting existing generated URLs, I am all ears.

sloorush commented 1 year ago

@razetime, Ah okay, I guess for sharing the golf URL you "need" to keep those permalinks. Is that correct?

sloorush commented 1 year ago

Shooting from the hip, can you store stuff like options in the permalinks so people can just bookmark them and it opens the same options they set the last time they updated the bookmarks?

razetime commented 1 year ago

i had an idea earlier today: if there are no URL parameters given, then APLgolf will restore the previous session. Does that sound okay?

sloorush commented 1 year ago

Yep, that sounds reasonable to me!

On Sat, 11 Feb 2023 at 14:44, Raghu R @.***> wrote:

i had an idea earlier today: if there are no URL parameters given, then APLgolf will restore the previous session. Does that sound okay?

— Reply to this email directly, view it on GitHub https://github.com/razetime/APLgolf/issues/6#issuecomment-1426670119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM7UPZK5BNXEOW2B4QVI67DWW5KATANCNFSM6AAAAAAUXTJ5BQ . You are receiving this because you authored the thread.Message ID: @.***>

razetime commented 1 year ago

i've changed the source to preserve options on a non-permalink. do tell me if it breaks, the code is held together with duct tape.

sloorush commented 1 year ago

When I try it with tryAPL it just goes to running mode and does not return a result.

Is this happening to you as well?

razetime commented 1 year ago

pleas explain the steps you performed exactly.

sloorush commented 1 year ago
image

It just gets stuck on running (is there something on doing incorrectly?)

sloorush commented 1 year ago
image

this works...

but anything with tryAPL gets stuck on "running"

razetime commented 1 year ago

i am not able to recreate this problem. try sending a permalink.

sloorush commented 1 year ago

APL(Dyalog Unicode), 4 bytes SBCS

{⍵}5

Try it on APLgolf!

A full program which ____.

sloorush commented 1 year ago

These might be helpful to debug

Console logs: image

Network tab: image

image
razetime commented 1 year ago

the permalink runs correctly. it may have been some problem with the tryapl side. just try a hard refresh with ctrl+F5.

sloorush commented 1 year ago

oh, still doesn't work for me (not even with incognito). I'll check it out in the evening maybe, something to do with network cache. I'll let you know

Edit: maybe this is something with safari?

razetime commented 1 year ago

it might be? I will ask on the apl farm.

razetime commented 1 year ago

So, this is apparently a CORS issue on safari (not sure if it's only Safari) that pops up after ~30 seconds. This is not related to localStorage so please make a new issue.