add warning toast
This commit is contained in:
parent
98c82aa126
commit
15d8946327
1 changed files with 7 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
class NodeCounter {
|
class NodeCounter {
|
||||||
private parent: NodeCounter | null = null;
|
private parent: NodeCounter | null = null;
|
||||||
|
|
||||||
|
|
@ -15,6 +17,11 @@ class NodeCounter {
|
||||||
newChild(): NodeCounter {
|
newChild(): NodeCounter {
|
||||||
const child = new NodeCounter();
|
const child = new NodeCounter();
|
||||||
this.children.push(child);
|
this.children.push(child);
|
||||||
|
if (this.children.length === 5000) {
|
||||||
|
toast.warn('An element with 5,000+ children was found. This can slow down rendering and degrade performance.', {
|
||||||
|
autoClose: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
child.parent = this;
|
child.parent = this;
|
||||||
this.bubbleCount(1);
|
this.bubbleCount(1);
|
||||||
return child;
|
return child;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue