-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug modal on Tx Queue tab when a transaction is executed (#146)
* Bump version 0.2.0-beta * Bump version 0.3.0-beta * Fix modal view behaviour
- Loading branch information
1 parent
1d1aa1e
commit e331924
Showing
3 changed files
with
70 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import router from "next/router"; | ||
import { useCallback } from "react"; | ||
|
||
interface UrlParameter { | ||
name: string; | ||
value: string; | ||
} | ||
|
||
interface UseReplaceUrlParam { | ||
replaceUrlParam: ({ name, value }: UrlParameter) => void; | ||
} | ||
|
||
export function useReplaceURLParam(): UseReplaceUrlParam { | ||
const replaceUrlParam = useCallback(({ name, value }: UrlParameter) => { | ||
const newQueryParams = { ...router.query }; | ||
|
||
// Assigns the parameter value based on the provided parameter name | ||
newQueryParams[name] = value; | ||
|
||
router.replace( | ||
{ | ||
pathname: router.pathname, | ||
query: newQueryParams, | ||
}, | ||
undefined, | ||
{ shallow: true } | ||
); | ||
}, []); | ||
|
||
return { replaceUrlParam }; | ||
} |