fix: check if ref is present before setting overflow position
This commit is contained in:
@@ -97,9 +97,11 @@ const NoteTags = observer(({ application, appState }: Props) => {
|
|||||||
if (tagsContainerExpanded || !lastVisibleTagIndex) {
|
if (tagsContainerExpanded || !lastVisibleTagIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { offsetLeft: lastVisibleTagLeft, clientWidth: lastVisibleTagWidth } =
|
if (tagsRef.current[lastVisibleTagIndex]) {
|
||||||
|
const { offsetLeft: lastVisibleTagLeft, clientWidth: lastVisibleTagWidth } =
|
||||||
tagsRef.current[lastVisibleTagIndex];
|
tagsRef.current[lastVisibleTagIndex];
|
||||||
setOverflowCountPosition(lastVisibleTagLeft + lastVisibleTagWidth);
|
setOverflowCountPosition(lastVisibleTagLeft + lastVisibleTagWidth);
|
||||||
|
}
|
||||||
}, [lastVisibleTagIndex, tagsContainerExpanded]);
|
}, [lastVisibleTagIndex, tagsContainerExpanded]);
|
||||||
|
|
||||||
const expandTags = () => {
|
const expandTags = () => {
|
||||||
@@ -142,7 +144,7 @@ const NoteTags = observer(({ application, appState }: Props) => {
|
|||||||
tagResizeObserver.disconnect();
|
tagResizeObserver.disconnect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [reloadTagsContainerLayout]);
|
}, [reloadTagsContainerLayout, tags]);
|
||||||
|
|
||||||
const tagClass = `h-6 bg-contrast border-0 rounded text-xs color-text py-1 pr-2 flex items-center
|
const tagClass = `h-6 bg-contrast border-0 rounded text-xs color-text py-1 pr-2 flex items-center
|
||||||
mt-2 cursor-pointer hover:bg-secondary-contrast focus:bg-secondary-contrast`;
|
mt-2 cursor-pointer hover:bg-secondary-contrast focus:bg-secondary-contrast`;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { AppState } from './app_state';
|
|||||||
|
|
||||||
export class ActiveNoteState {
|
export class ActiveNoteState {
|
||||||
tags: SNTag[] = [];
|
tags: SNTag[] = [];
|
||||||
tagsContainerMaxWidth: number | 'auto' = 'auto';
|
tagsContainerMaxWidth: number | 'auto' = 0;
|
||||||
tagsContainerExpanded = false;
|
tagsContainerExpanded = false;
|
||||||
overflowedTagsCount = 0;
|
overflowedTagsCount = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user