fix(datetime): disable intersection observer during month update (#24713)

Resolves #24712
This commit is contained in:
Sean Perkins
2022-02-04 11:39:21 -05:00
committed by GitHub
parent df84d155ea
commit aab4d306f8

View File

@ -771,17 +771,26 @@ export class Datetime implements ComponentInterface {
*/ */
writeTask(() => { writeTask(() => {
this.setWorkingParts({ // Disconnect all active intersection observers
...this.workingParts, // to avoid a re-render causing a duplicate event.
month, if (this.destroyCalendarIO) {
day: day!, this.destroyCalendarIO();
year }
});
raf(() => { raf(() => {
this.setWorkingParts({
...this.workingParts,
month,
day: day!,
year
});
calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1); calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
calendarBodyRef.style.removeProperty('overflow'); calendarBodyRef.style.removeProperty('overflow');
calendarBodyRef.style.removeProperty('pointer-events'); calendarBodyRef.style.removeProperty('pointer-events');
endIO?.observe(endMonth);
startIO?.observe(startMonth);
}); });
/** /**