mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
fix(core): fix target block cannot be reached when clicking affine-link multiple times (#10473)
Closes: [BS-2702](https://linear.app/affine-design/issue/BS-2702/超链接无法滚动到指定block)
This commit is contained in:
@@ -2,6 +2,7 @@ import type { SettingTab } from '@affine/core/modules/dialogs/constant';
|
||||
import { toURLSearchParams } from '@affine/core/modules/navigation';
|
||||
import { getOpenUrlInDesktopAppLink } from '@affine/core/modules/open-in-app';
|
||||
import type { DocMode } from '@blocksuite/affine/model';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { createContext, useCallback, useContext, useMemo } from 'react';
|
||||
import type { NavigateFunction, NavigateOptions } from 'react-router-dom';
|
||||
|
||||
@@ -48,7 +49,12 @@ export function useNavigateHelper() {
|
||||
elementIds?: string[],
|
||||
logic: RouteLogic = RouteLogic.PUSH
|
||||
) => {
|
||||
const search = toURLSearchParams({ mode, blockIds, elementIds });
|
||||
const search = toURLSearchParams({
|
||||
mode,
|
||||
blockIds,
|
||||
elementIds,
|
||||
refreshKey: nanoid(),
|
||||
});
|
||||
const query = search?.size ? `?${search.toString()}` : '';
|
||||
return navigate(`/workspace/${workspaceId}/${pageId}${query}`, {
|
||||
replace: logic === RouteLogic.REPLACE,
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
useServices,
|
||||
} from '@toeverything/infra';
|
||||
import clsx from 'clsx';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import type { Subscription } from 'rxjs';
|
||||
@@ -207,6 +208,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
||||
mode: params?.mode,
|
||||
blockIds: params?.blockIds,
|
||||
elementIds: params?.elementIds,
|
||||
refreshKey: nanoid(),
|
||||
},
|
||||
{
|
||||
at: at,
|
||||
|
||||
Reference in New Issue
Block a user