Fix stricterdom for lovely-chart (#6957)

This commit is contained in:
Alexander Zinchuk 2026-06-01 01:15:24 +02:00
parent d1597b43a5
commit fcf7b45a6f
5 changed files with 10 additions and 4 deletions

View File

@ -178,7 +178,7 @@ function MessageStatistics({
{(!loadedChartsRef.current.size || !statistics.publicForwardsData) && <Loading />}
<div ref={containerRef}>
<div ref={containerRef} data-stricterdom-ignore>
{GRAPHS.map((graph) => {
const isGraphReady = loadedChartsRef.current.has(graph) && !errorChartsRef.current.has(graph);
return (

View File

@ -245,7 +245,7 @@ const MonetizationStatistics = ({
{!loadedChartsRef.current.size && <Loading />}
<div ref={containerRef} className={styles.section}>
<div ref={containerRef} className={styles.section} data-stricterdom-ignore>
{MONETIZATION_GRAPHS.filter(Boolean).map((graph) => (
<div key={graph} className={buildClassName(styles.graph, styles.hidden)} />
))}

View File

@ -209,7 +209,7 @@ const Statistics = ({
{!loadedChartsRef.current.size && <Loading />}
<div ref={containerRef}>
<div ref={containerRef} data-stricterdom-ignore>
{graphs.map((graph) => {
const isGraphReady = loadedChartsRef.current.has(graph) && !errorChartsRef.current.has(graph);
return (

View File

@ -183,7 +183,7 @@ function StoryStatistics({
{!loadedChartsRef.current.size && <Loading />}
<div ref={containerRef}>
<div ref={containerRef} data-stricterdom-ignore>
{GRAPHS.map((graph) => {
const isGraphReady = loadedChartsRef.current.has(graph) && !errorChartsRef.current.has(graph);
return (

View File

@ -54,6 +54,7 @@ export function forceMeasure(cb: () => any) {
}
const forcedMutationAllowedFor = new Set<Node>();
const IGNORE_SUBTREE_ATTR = 'data-stricterdom-ignore';
export function forceMutation(cb: () => any, nodes: Node | Node[]) {
if (phase !== 'measure') {
@ -167,6 +168,11 @@ function setupMutationObserver() {
return;
}
const targetElement = target instanceof Element ? target : target.parentElement;
if (targetElement?.closest(`[${IGNORE_SUBTREE_ATTR}]`)) {
return;
}
if (type === 'childList' && target instanceof HTMLElement && target.contentEditable) {
return;
}