Closed stebanos closed 6 years ago
So you want that the URL should be changed as an when the user changes the seed, without the need of saving it right?
In any case, this can be done in two ways:-
I think the 2nd option is much more efficient than the first one. What do you think?
I don't think there is a need to add to the database You could just check the URL when the page loads and generate the sketch according to the seed mentioned in the URL.
Also, it would be nice if there was some sort of "claiming an issue" procedure. Because I too had started to work on the issue. 😅 @stebanos What do you think?
To avoid confusion, right now, when you press 'Save', the sketch is already stored with the seed that is the current seed. The URL that appears will load the same sketch with -that- seed every time. For example the sketch -L4uLB99JzFHMPcVoiTm will always be loaded with the seed GKA. This is good, because it allows to present you with an example output that you are happy with.
So, this issue is not about saving, but more about being able to bookmark different variations of the same sketch that you like, without the need to push more data to the database.
Regarding GSOC, Frederik is abroad this week, but we will talk about it soon.
@stebanos Okay. Got it. 👍
@TanviKumar So you are proceeding with this issue futher, right?
@kunal-mohta yes, I am.
Currently, when a sketch is loaded it takes the value of the saved seed version. However, this way different variations of the same sketch can't be easily bookmarked, without saving a new version first, even if nothing in the code changes. A better way is to add an optional query string, for example
?seed=IJX
in the URL.The application should use this seed if present, and otherwise use the saved seed value as is now the case (if it was saved in the first place). Furthermore, if the seed value changes, the URL should reflect the newly set seed, so that it can be bookmarked by the user. This needs to be done in a careful way though, because setting the URL through javascript causes the page to reload, and we don't want that. However, apparently we can manipulate the URL through
window.history.pushState()
, which doesn't trigger a page load so this might be the better way to go.I think this is a better way of handling the issue described in #8