Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ export const SettingsDialog = React.memo((props: UseDialogProps) => {
setQueryParams({ destinationAddress: undefined })
setDestinationAddress(undefined)
} else {
setQueryParams({ destinationAddress })
// If string is empty, we want to remove the param from URL (passing undefined)
setQueryParams({
destinationAddress: destinationAddress || undefined
})
}
}}
isFooterHidden
Expand Down
7 changes: 4 additions & 3 deletions packages/arb-token-bridge-ui/src/hooks/useArbQueryParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export const useArbQueryParams = () => {
setQueryParams (setter for all query state variables with debounced accumulator)
]
*/
const [queryParams, setQueryParams] = useQueryParams()
const [queryParams, setQueryParams] =
useQueryParams<typeof queryParamProviderOptions.params>()

const debouncedSetQueryParams = useCallback(
(
Expand All @@ -145,7 +146,7 @@ export const useArbQueryParams = () => {
return [queryParams, debouncedSetQueryParams] as const
}

export const queryParamProviderOptions: QueryParamOptions = {
export const queryParamProviderOptions = {
searchStringToObject: queryString.parse,
objectToSearchString: queryString.stringify,
updateType: 'replaceIn', // replace just a single parameter when updating query-state, leaving the rest as is
Expand All @@ -164,7 +165,7 @@ export const queryParamProviderOptions: QueryParamOptions = {
mode: withDefault(ModeParam, undefined), // mode: 'embed', or undefined for normal mode
theme: withDefault(ThemeParam, defaultTheme) // theme customization
}
}
} as const satisfies QueryParamOptions
export function ArbQueryParamProvider({
children
}: {
Expand Down
Loading