Why are my exercises reset automaticly?

E.x. In the Celsius to Fahrenheit, after I passed and went to the next exercise, the answer I had, was reset. On the other hand, sometimes my exercises are not reset. Why is this happening and how to make it that no exercise is reset after completing it?

1 Like

Does anyone know the answer?

I would not count on the FCC website to save your solutions for you. I think when you submit your answer (after you “Run the Tests” and hit “Submit and go to next challenge”) it discards what you had.

I’m in intermediate algorithm scripting under JS algorithms and data structures, and I do all of my work in vscode.

It will get you used to working with an IDE and provide a lot more functionality than the online code editor. Plus you won’t accidently lose your work.

Good luck!

Hello there,

There are two different types of saved progress for Free Code Camp: your profile and your browser cache.

A list of your completed challenges is saved to your account in the FCC database. You can see the list of completed challenges by looking at your public portfolio. With a growing curriculum already over 1,400 lessons and a community of millions of people, FCC does not store every solution to every challenge in its database. When you complete a challenge, there is a modal that gives you the option to download your solution. This gives you the option to save a copy of any solution that you may want to reference later. There are some challenges which are classified as projects required for certifications. Your solutions to those can be viewed on your settings page.

Your in-editor code is saved in your browser’s local storage. Recent in-progress code from the challenge editor is also saved in your local browser cache when you run tests. If you are completing lessons and do not see your recent code, then your local storage has been cleared or something is preventing FCC from writing to your browser’s storage. This could be a browser setting, a privacy extension, or a browser version incompatibility. Especially as you get to more complicated challenges that may take multiple sessions, I strongly recommend saving your in-progress work outside of the browser cache.

This is a good opportunity to learn the ins and outs of your GitHub account, but you can also just save locally or use a service like repl.it which allows for versioning.

1 Like

The localStorage doesn’t work when logged in though. I’m pretty sure it gets automatically cleared. As far as I remember reading, it is intentional. If that is supposed to have changed it doesn’t work for me (when logged in).

I think there is to dig in issues on GitHub to see what happened there

Are you saying you believe it should save it?

I don’t really know the usage of any of the libs used (rxjs, redux-observable, saga, etc.) so reading the code is slightly gibberish to me. I also have never looked at the code so it isn’t exactly the easiest to follow.

But doesn’t it clear it on submit (appTypes.submitComplete => store.remove(id))

My understanding is:

  • If Ctrl + S is used, the code is saved to local storage - unless it is full. This is deleted per browser request.
  • If the state of the editor is allowed to update (add code, and not leave the page too quickly), then the code is saved by the browser per browser cache spec - I have very little idea about this, but it is unintentional behaviour on freeCodeCamp

Otherwise, the the clearing of code does not touch the local storage - just the store state.

Doesn’t look like it to me.

First challenge:

First challenge save:

Second challenge (edit: just to be clear. I didn’t dismiss the message so it is just the save message from the first challenge):

For completeness, here it is without being logged in. Exact same steps.

EDIT: Ah… I now see the problem…

Before saving:

After saving (last entry):

here, it was closed as decayed, never fixed, we could reopen it if needed, or create a new one

I wasn’t sure if it was the correct code I pointed to so I tested by removing appTypes.submitComplete from ofType in the clearCodeEpic function and it works.

I’m really not sure what the PR that implemented the Ctrl + S feature was meant to do when logged in. I’m still pretty sure the clearing of localStorage is intentional for logged-in users. If it isn’t, it’s an easy fix.

But I’m not so sure that sharing the same localStorage between a logged-in and not logged-in user is such a good idea. It would be better if we saved to different stores depending on the logged-in state.

Also, reading the issue linked to just confuses me. I can’t tell if it is a wanted or not wanted feature.

I have discovered the expected behaviour:

A Camper can Ctrl + S as many challenges as the browser allows, but if the Camper clicks the Submit button on any challenge, the code is purposefully removed from localStorage, as it is assumed the Camper is done with the challenge, and has little/less need for the saved code.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.