Skip to content

Commit 67efafc

Browse files
authored
perf(Typography): fast and efficient syncEllipsis (#7146)
1 parent a8a774a commit 67efafc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

components/typography/Base.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const Base = defineComponent({
166166
});
167167
onMounted(() => {
168168
state.clientRendered = true;
169+
syncEllipsis();
169170
});
170171

171172
onBeforeUnmount(() => {
@@ -180,7 +181,7 @@ const Base = defineComponent({
180181
resizeOnNextFrame();
181182
});
182183
},
183-
{ flush: 'post', deep: true, immediate: true },
184+
{ flush: 'post', deep: true },
184185
);
185186

186187
watchEffect(() => {
@@ -296,7 +297,12 @@ const Base = defineComponent({
296297
);
297298

298299
// ============== Ellipsis ==============
299-
function resizeOnNextFrame() {
300+
function resizeOnNextFrame(sizeInfo?: { width: number; height: number }) {
301+
if (sizeInfo) {
302+
const { width, height } = sizeInfo;
303+
if (!width || !height) return;
304+
}
305+
300306
raf.cancel(state.rafId);
301307
state.rafId = raf(() => {
302308
// Do not bind `syncEllipsis`. It need for test usage on prototype

0 commit comments

Comments
 (0)