Embed Miscellaneous Improvements and Fixes (#2499)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2022-04-25 10:03:00 +05:30
1 parent 53d7e57142
commit 93c75b5fef
83 files changed
+1139 -746

No files matched your search

+6 -4
View File
@@ -13,12 +13,17 @@ export default function Cal({
config?: any;
embedJsUrl?: string;
}) {
if (!calLink) {
throw new Error("calLink is required");
}
const initializedRef = useRef(false);
const Cal = useEmbed(embedJsUrl);
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!Cal) {
if (!Cal || initializedRef.current) {
return;
}
initializedRef.current = true;
const element = ref.current;
let initConfig = {};
if (calOrigin) {
@@ -30,9 +35,6 @@ export default function Cal({
calLink,
config,
});
return () => {
element?.querySelector(".cal-embed")?.remove();
};
}, [Cal, calLink, config, calOrigin]);
if (!Cal) {
+3
View File
@@ -0,0 +1,3 @@
import Cal from "./Cal";
export default Cal;