Skip to content

Commit f28ea92

Browse files
fix: schedule meta sync after remove container
1 parent 92cb2a1 commit f28ea92

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/manager.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ class Manager {
9090
order: 'data-order',
9191
};
9292

93+
/**
94+
* Scheduled synchronization
95+
*/
96+
protected syncTimerId: null | NodeJS.Timeout = null;
97+
9398
/**
9499
* @constructor
95100
*/
@@ -392,6 +397,10 @@ class Manager {
392397
protected syncMeta(containerId?: string): void {
393398
const { meta, html, body } = this.getTags();
394399

400+
if (this.syncTimerId) {
401+
clearTimeout(this.syncTimerId);
402+
}
403+
395404
// apply html, body props
396405
for (const { name, value } of [
397406
{ name: 'html', value: html },
@@ -519,6 +528,7 @@ class Manager {
519528
this.tags.body.delete(containerId);
520529
this.tags.html.delete(containerId);
521530
this.tags.containers.delete(containerId);
531+
this.syncTimerId = setTimeout(() => this.syncMeta(), 500);
522532
}
523533

524534
/**

0 commit comments

Comments
 (0)