-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(front+server): 個人ページ(noteId === null)概念を根絶し Page.noteId を non-null 化 (#1020) #1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9432a97
ee0b8e2
629fa41
eb6cd52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| import React, { useCallback } from "react"; | ||||||
| import { createPortal } from "react-dom"; | ||||||
| import type { Editor } from "@tiptap/core"; | ||||||
| import { usePageStore } from "@/stores/pageStore"; | ||||||
| import { usePageByTitle, useGhostLinkReferenced } from "@/hooks/pages/usePageQueries"; | ||||||
| import { WikiLinkPreviewContent } from "@/components/wikiLink/WikiLinkPreviewContent"; | ||||||
| import { useWikiLinkHover } from "./useWikiLinkHover"; | ||||||
|
|
||||||
|
|
@@ -39,16 +39,15 @@ export const WikiLinkHoverCardLayer: React.FC<WikiLinkHoverCardLayerProps> = ({ | |||||
| const { target, isVisible, cardRef, closeCard, handleCardMouseEnter, handleCardMouseLeave } = | ||||||
| useWikiLinkHover(editor, editorContainerRef); | ||||||
|
|
||||||
| const page = usePageStore((state) => { | ||||||
| if (!target) return undefined; | ||||||
| return state.getPageByTitle(target.title); | ||||||
| }); | ||||||
| // 旧ゲストストア (`pageStore`) は Issue #1020 で廃止したため、リポジトリ | ||||||
| // (IndexedDB)ベースのクエリでページ解決とゴースト参照判定を行う。 | ||||||
| // The legacy guest store (`pageStore`) was retired by issue #1020; resolve | ||||||
| // the page and the ghost-reference state via the repository (IndexedDB). | ||||||
| const { data: resolvedPage } = usePageByTitle(target?.title ?? ""); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When
Suggested change
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 対応不要と判断しました。 No change needed: Generated by Claude Code |
||||||
| const page = resolvedPage ?? undefined; | ||||||
|
|
||||||
| const referenced = usePageStore((state) => { | ||||||
| if (!target) return false; | ||||||
| const resolved = state.getPageByTitle(target.title); | ||||||
| return !resolved && state.ghostLinks.some((gl) => gl.linkText === target.title); | ||||||
| }); | ||||||
| const { data: ghostReferenced = false } = useGhostLinkReferenced(target?.title ?? ""); | ||||||
| const referenced = !page && ghostReferenced; | ||||||
|
|
||||||
| const handleCardClick = useCallback(() => { | ||||||
| if (!target) return; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
normalizedTitleis empty, callingusePageByTitlewill trigger an unnecessary IndexedDB query. To prevent redundant database access, consider passing anenabledoption to skip the query when the title is empty.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応不要と判断しました。
usePageByTitleは内部でenabled: isLoaded && title.trim().length > 0をガードしており、空タイトルでクエリは発火しません(options 引数も受け取らないため提案のシグネチャはコンパイルできません)。No change needed:
usePageByTitlealready has the internal guardenabled: isLoaded && title.trim().length > 0, so an empty title never hits IndexedDB (and the hook takes no options parameter).Generated by Claude Code