-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Import & Export from Github causes reloading the playground even…
… before accept this step. (#1908) ## Motivation for the change, related issues Issue #1902 ## Implementation details Import & Export from Github causes reloading the playground even before accept this step. I know that it is because of adding new params in the URL. So I kept functionality to fire those modal via URL, but I also added logic to open those modals without adding params. ## Testing Instructions (or ideally a Blueprint) 1. open http://127.0.0.1:5400/website-server/ 2. Go to playground settings 3. Click 3 dots next to "Homepage" button 4. Click export or import from GitHub 5. Modal should appear without reloading Also you can check, that opening on slug is still working (but with reloading on closing popup): http://127.0.0.1:5400/website-server/?modal=github-import --------- Co-authored-by: Brandon Payton <[email protected]>
- Loading branch information
1 parent
33e7d55
commit 1e51248
Showing
9 changed files
with
127 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
packages/playground/website/src/components/toolbar-buttons/github-export-menu-item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
packages/playground/website/src/components/toolbar-buttons/github-import-menu-item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 17 additions & 23 deletions
40
packages/playground/website/src/github/github-export-form/modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { useEffect, useRef } from "react"; | ||
|
||
export const usePrevious = <T>(value: T): T | undefined => { | ||
const ref = useRef<T>(); | ||
useEffect(() => { | ||
ref.current = value; | ||
}); | ||
return ref.current; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters