omegaup / omegaup

omegaUp automatic programming contest evaluator & arena
https://omegaup.com
Other
224 stars 294 forks source link

[FEATURE] Remove or review dead code in `ephemeral.js` #7652

Closed HNOONa-0 closed 3 weeks ago

HNOONa-0 commented 3 weeks ago

We have the following piece of code for hashchange event: https://github.com/omegaup/omegaup/blob/5513fb1f507c5f6f3b0eb432d6ad19e06c5c0590/frontend/www/js/omegaup/grader/ephemeral.js#L985-L1053

This code never actually execute beyond the first if statement. This is because window.location.hash references link to embed IDE iframe, which is always empty (not actual link of the page that is the parent window). Here is a picture of what I mean. image

It's probably safe to remove.

pabo99 commented 3 weeks ago

This code might indeed be necessary if we use it in a different context than the one shown in your example.

What I mean is the following case: We have a different way of accessing the ephemeral component, which is by visiting the URL: http://localhost:8001/grader/ephemeral.

If you add a hash to this URL, you will now be accessing the code you intend to remove, since in this case, it is not being embedded in an iframe, but rather you are directly displaying the component.

image

So, for now, you can leave this code as it is.

HNOONa-0 commented 3 weeks ago

That makes sense. Alright then, closing this.