Skip to content

Commit

Permalink
fix: update navigation logic in ControlPanel and Profile to handle ed…
Browse files Browse the repository at this point in the history
…itAnimationId correctly
  • Loading branch information
justinfernald committed Jan 4, 2025
1 parent 31f4e60 commit 857bd79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/routes/control-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export const ControlPanel = observer(() => {

const urlEncoded = LZString.compressToEncodedURIComponent(code);

navigate(`/editor?edit=${editAnimationId}#${urlEncoded}`);
if (editAnimationId) {
navigate(`/editor?edit=${editAnimationId}#${urlEncoded}`);
return;
}

navigate(`/editor#${urlEncoded}`);
};

return (
Expand Down
7 changes: 6 additions & 1 deletion src/routes/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export const Profile = observer(() => {

const urlEncoded = LZString.compressToEncodedURIComponent(code);

navigate(`/editor?edit=${editAnimationId}#${urlEncoded}`);
if (editAnimationId) {
navigate(`/editor?edit=${editAnimationId}#${urlEncoded}`);
return;
}

navigate(`/editor#${urlEncoded}`);
};

useEffect(() => {
Expand Down

0 comments on commit 857bd79

Please sign in to comment.