Skip to content
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

chore(core): use displayed value for document title #8268

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore(core): use displayed value for document title
  • Loading branch information
pedrobonamin committed Jan 14, 2025
commit db8a0b12ee818a252ea2ffb10acef754aec3c511
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ interface UseDocumentTitle {
* @returns The document title or error. See {@link UseDocumentTitle}
*/
export function useDocumentTitle(): UseDocumentTitle {
const {connectionState, schemaType, title, editState} = useDocumentPane()
const documentValue = editState?.draft || editState?.published
const subscribed = Boolean(documentValue)
const {connectionState, schemaType, title, displayed} = useDocumentPane()
const {t} = useTranslation(structureLocaleNamespace)
const subscribed = Boolean(displayed)

const {error, value} = useValuePreview({
enabled: subscribed,
schemaType,
value: documentValue,
value: displayed,
})

if (connectionState === 'connecting' && !subscribed) {
Expand All @@ -42,7 +41,7 @@ export function useDocumentTitle(): UseDocumentTitle {
return {error: undefined, title}
}

if (!documentValue) {
if (!displayed) {
return {
error: undefined,
title: t('panes.document-header-title.new.text', {
Expand Down
Loading