fix(core): unexpected routing history appears on the shared page (#8356)

close AF-1429

https://github.com/user-attachments/assets/a99cf79d-3615-4e0f-835c-2e66b1a34863
This commit is contained in:
JimmFly
2024-09-24 04:02:07 +00:00
parent 9eae3de1ae
commit 75bc6df915
2 changed files with 100 additions and 11 deletions

View File

@@ -165,18 +165,24 @@ export function AffineSharedPageReference({
const isJournal = journalHelper.isPageJournal(pageId);
const onClick = useCallback(() => {
if (isJournal) {
track.doc.editor.pageRef.navigate({
to: 'journal',
});
}
const onClick = useCallback(
(e: React.MouseEvent) => {
if (isJournal) {
track.doc.editor.pageRef.navigate({
to: 'journal',
});
}
// update refresh key
setRefreshKey(nanoid());
// update refresh key
setRefreshKey(nanoid());
return;
}, [isJournal]);
// Prevent blocksuite link clicked behavior
e.stopPropagation();
return;
},
[isJournal]
);
const query = useMemo(() => {
// A block/element reference link