Skip to content

Commit 4ccf109

Browse files
CopilotomBratteng
andauthored
fix: feed-by-ids losing posts when closing modal (#5327)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: omBratteng <1681525+omBratteng@users.noreply.github.com>
1 parent bf67a10 commit 4ccf109

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/shared/src/hooks/usePostModalNavigation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ export const usePostModalNavigation = ({
241241
isFetchingNextPage: false,
242242
selectedPostIsAd,
243243
onCloseModal: async () => {
244-
const searchParams = new URLSearchParams(window.location.search);
244+
// Extract query params from baseAsPath to preserve original params like 'id'
245+
const baseUrl = new URL(baseAsPath, window.location.origin);
246+
const searchParams = new URLSearchParams(baseUrl.search);
245247

246248
await router.push(
247249
getPathnameWithQuery(basePathname, searchParams),

0 commit comments

Comments
 (0)