The code in the Exercism 'editor' appears to store its contents on the client, is this by design?

I end up using Exercism from two different machine on a regular basis. So I noticed that the contents of the code editor will be different for any given exercise between the two machines. i.e. if I make a change on the editor for a given exercise on one machine it has no effect on the contents of the same editor when accessed from another machine. This should mean that the editor’s contents is stored locally… Is this by design or an oversite?

If this is occurring, I’d guess that it’s by design. The idea is, when you submit an iteration, it’s saved by Exercism - until then, you’re playing around trying to solve it.

But the team would doubtless be better placed to answer your doubt.

It’s not stored locally as in on your machine, the code simply lives in the browser tab in a state object connected to the specific editor view. You could test this by opening multiple tabs/windows, and each instance is independent from the others.

It’s not stored locally as in on your machine, the code simply lives in the browser tab in a state object connected to the specific editor view. You could test this by opening multiple tabs/windows, and each instance is independent from the others.

Okeydokey. But I am sure you can see my confusion. Most applications that people use on a daily basis do not treat data on a per machine plus per account basis. It’s generally either/or. Right? We are not forced to have a completely diffeent set of documents for when we access Google docs from our phone versus from our PC at the house… Which, based on my original question and your answer, is what is being described.

If there really is two separated data objects on the Exercism server for that same exercise’s code editor, then how do I tell the serve which one I want?

Supplemental Info

Since I figure my use of two different machines is probably an edge case. And since I usually take a day or two to do some of these exercises. Here is what I am seeing/asking about in a nutshell:

  1. I log in on PC #1 and access one specific exercise’s editor (Windows + Edge). I clear it out and type “FOO” into it. Close the browser.
  2. I restart that PC. I open the browser (Windows + Edge), log into Exercism. I access the same exercise’s editor. It still contains “FOO”.
  3. I drive 20 miles to another building (probably superfluous info, but hey.) I power up PC #2. I log into Exercism through a different web browser (Linux + Google Chrome.) I access the editor for the same exercise and it contains the default boiler plate code, not “FOO”. SO I clear that window and type in “BAR”.
  4. Restart PC #2. Log in to Exercism (using Linux + Google Chrome) and that exercise’s editor still contains “BAR”.
  5. Now I go back to other PC #1, which is 20 miles away. I log into Exercism (Windows + Edge again.) And I access that same exercise’s editor, only to find “FOO”.
  6. Unless I change something; from PC #1 I will see “FOO”, and from PC #2 I will see “BAR”.

Hope this is clearer than whatever I posted originally.

When you submit an iteration, that effectively creates a “save point” which is saved on our server and is therefore consistent across all machines (you can choose “…” → “revert to last iteration” to sync this on a different machine).

We also store your code in local storage on your machine, so if you are half way through solving something but not run the tests and you come back later, it’s still there and you don’t lose it.

There’s also a third case which is when you run the tests, we create a sort of more internal save point, which we also propogate around machines. However, the local storage overrides this. So if you run the tests on machine 1, then go to machine 2, you’ll see your latest code there. If you then edit that code, those edits persist on machine 2, and at that stage machine 1 and machine 2 have diverged, so when you go back to machine 1 you won’t see your latest code. Clearing local storage will result in that machine reverting to the code at the last time you ran the tests.

Does that explain more clearly?

2 Likes

Does that explain more clearly?

Yes. :)

I wouldn’t even have noticed if I hadn’t dithered so long over one particular exercise.

Thanks for clearing that up for me!

1 Like