From cb6873843f629923c94ddae48d3ef77980ae5398 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 1 Oct 2021 13:52:47 +0800 Subject: [PATCH] Add option to pass in url-search params. Impetus: allow linked comment ID and setting the discussion tab when clicking on the `ClaimPreview`. --- ui/component/claimPreview/view.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index 343424d5f..34e7dc188 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -70,6 +70,7 @@ type Props = { streamingUrl: ?string, getFile: (string) => void, customShouldHide?: (Claim) => boolean, + searchParams?: { [string]: string }, showUnresolvedClaim?: boolean, showNullPlaceholder?: boolean, includeSupportAction?: boolean, @@ -125,6 +126,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { // modifiers active, customShouldHide, + searchParams, showNullPlaceholder, // value from show mature content user setting // true if the user doesn't wanna see nsfw content @@ -221,6 +223,11 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { if (listId) { navigateSearch.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId); } + if (searchParams) { + Object.keys(searchParams).forEach((key) => { + navigateSearch.set(key, searchParams[key]); + }); + } const handleNavLinkClick = (e) => { if (onClick) {