Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
497 B
1
Indexable
Never
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}</>;
};
Leave a Comment