Skip to content

Commit 0348894

Browse files
committed
🐛(frontend) fix rerender title with broadcasting
The title was not rerendering on other clients when the title was updated by one client. This commit fixes the issue. We set a min width for the title as well, it will fix the issue with strange behavior when people were double clicking.
1 parent 9b17d8b commit 0348894

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and this project adheres to
3333
- 🦺(backend) add comma to sub regex #408
3434
- 🐛(editor) collaborative user tag hidden when read only #385
3535
- 🐛(frontend) users have view access when revoked #387
36+
- 🐛(frontend) fix placeholder editable when double clicks #454
3637

3738

3839
## [1.7.0] - 2024-10-24

src/frontend/apps/impress/src/features/docs/doc-header/components/DocTitle.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
5757
const { broadcast } = useBroadcastStore();
5858

5959
const { mutate: updateDoc } = useUpdateDoc({
60-
listInvalideQueries: [KEY_DOC, KEY_LIST_DOC],
60+
listInvalideQueries: [KEY_LIST_DOC],
6161
onSuccess(data) {
6262
if (data.title !== untitledDocument) {
6363
toast(t('Document title updated successfully'), VariantType.SUCCESS);
@@ -104,6 +104,10 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
104104
}
105105
};
106106

107+
useEffect(() => {
108+
setTitleDisplay(doc.title);
109+
}, [doc.title]);
110+
107111
useEffect(() => {
108112
if ((!debounceRef.current && !isUntitled) || !headingText) {
109113
return;
@@ -129,6 +133,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
129133
$radius="4px"
130134
$padding={{ horizontal: 'tiny', vertical: '4px' }}
131135
$margin="none"
136+
$minWidth="200px"
132137
contentEditable={isFirefox() ? 'true' : 'plaintext-only'}
133138
onClick={handleOnClick}
134139
onBlurCapture={(e) =>

0 commit comments

Comments
 (0)