Fix hooks order
This commit is contained in:
parent
5aad759d32
commit
79386c10e0
@ -8,13 +8,6 @@ export default function Container({ error = false, children, service }) {
|
|||||||
const { settings } = useContext(SettingsContext);
|
const { settings } = useContext(SettingsContext);
|
||||||
const containerRef = useRef(null);
|
const containerRef = useRef(null);
|
||||||
const [childrensToSlice, setChildrensToSlice] = useState(0);
|
const [childrensToSlice, setChildrensToSlice] = useState(0);
|
||||||
if (error) {
|
|
||||||
if (settings.hideErrors || service.widget.hide_errors) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <Error service={service} error={error} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const childrenArray = Array.isArray(children) ? children : [children];
|
const childrenArray = Array.isArray(children) ? children : [children];
|
||||||
const numberOfChildren = childrenArray.filter((e) => e).length;
|
const numberOfChildren = childrenArray.filter((e) => e).length;
|
||||||
@ -80,6 +73,14 @@ export default function Container({ error = false, children, service }) {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
if (settings.hideErrors || service.widget.hide_errors) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <Error service={service} error={error} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="@container w-full" ref={containerRef}>
|
<div className="@container w-full" ref={containerRef}>
|
||||||
<div className={`relative grid p-1 gap-2 w-full auto-rows-max ${subColumnsClassMap[numberOfChildren]}`}>
|
<div className={`relative grid p-1 gap-2 w-full auto-rows-max ${subColumnsClassMap[numberOfChildren]}`}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user