Fix stricterdom for lovely-chart (#6957)
This commit is contained in:
parent
d1597b43a5
commit
fcf7b45a6f
@ -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 (
|
||||
|
||||
@ -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)} />
|
||||
))}
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user