Untitled

 avatar
unknown
plain_text
a year ago
497 B
4
Indexable
window.testIds = {};

export const VisibleIdsContextWrapper = ({
    children,
    id,
}: PropsWithChildren<{ id: ClickstreamProps["clickstreamId"] }>) => {
    useEffect(() => {
        const strId = id.toString();
        if (window.testIds[strId]) {
            throw new Error(`Duplicate id: ${strId}`);
        }
        window.testIds[strId] = true;

        return () => {
            delete window.testIds[strId];
        };
    }, [id]);

    return <>{children}</>;
};
Editor is loading...
Leave a Comment