Skip to content

Commit

Permalink
fix: REPL 'Share' button triggered confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Jun 30, 2024
1 parent 6dfd391 commit eb67ebd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/controllers/repl/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function Repl({ code }) {

// Clears the (now outdated) example & code query params
// when a user begins to modify the code
if (query.example || query.code) {
if (location.search) {
route('/repl', true);
}
};
Expand All @@ -56,7 +56,9 @@ export function Repl({ code }) {
// No reason to share semi-sketchy btoa'd code if there's
// a perfectly good example we can use instead
if (!query.example) {
route(`/repl?code=${encodeURIComponent(btoa(editorCode))}`, true);
// We use `history.replaceState` here as the code is only relevant on mount.
// There's no need to notify the router of the change.
history.replaceState(null, null, `/repl?code=${encodeURIComponent(btoa(editorCode))}`);
}

try {
Expand Down

0 comments on commit eb67ebd

Please sign in to comment.