Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

remove setPollLinks

Steven Tey431ed077c29b
diff --git a/apps/web/ui/modals/import-bitly-modal.tsx b/apps/web/ui/modals/import-bitly-modal.tsx
index ab15224328..e5ec358976 100644
--- a/apps/web/ui/modals/import-bitly-modal.tsx
+++ b/apps/web/ui/modals/import-bitly-modal.tsx
@@ -58,7 +58,6 @@ function ImportBitlyModal({
const [selectedGroupTags, setSelectedGroupTags] = useState<string[]>([]);
const [importing, setImporting] = useState(false);
- const { setPollLinks } = useContext(ModalContext);
useEffect(() => {
if (searchParams?.get("import") === "bitly") {
@@ -123,7 +122,6 @@ function ImportBitlyModal({
if (res.ok) {
await mutate(`/api/projects/${slug}/domains`);
router.push(`/${slug}`);
- setPollLinks(true);
} else {
setImporting(false);
throw new Error();
diff --git a/apps/web/ui/modals/import-short-modal.tsx b/apps/web/ui/modals/import-short-modal.tsx
index 67668f271f..a556f07d57 100644
--- a/apps/web/ui/modals/import-short-modal.tsx
+++ b/apps/web/ui/modals/import-short-modal.tsx
@@ -60,7 +60,6 @@ function ImportShortModal({
);
const [importing, setImporting] = useState(false);
- const { setPollLinks } = useContext(ModalContext);
useEffect(() => {
if (searchParams?.get("import") === "short") {
@@ -122,7 +121,6 @@ function ImportShortModal({
if (res.ok) {
await mutate(`/api/projects/${slug}/domains`);
router.push(`/${slug}`);
- setPollLinks(true);
} else {
setImporting(false);
throw new Error();
diff --git a/apps/web/ui/modals/provider.tsx b/apps/web/ui/modals/provider.tsx
index 1b20559547..8ab71e3089 100644
--- a/apps/web/ui/modals/provider.tsx
+++ b/apps/web/ui/modals/provider.tsx
@@ -31,7 +31,6 @@ export const ModalContext = createContext<{
setShowUpgradePlanModal: Dispatch<SetStateAction<boolean>>;
setShowImportBitlyModal: Dispatch<SetStateAction<boolean>>;
setShowImportShortModal: Dispatch<SetStateAction<boolean>>;
- setPollLinks: Dispatch<SetStateAction<boolean>>;
}>({
setShowAddProjectModal: () => {},
setShowCompleteSetupModal: () => {},
@@ -40,7 +39,6 @@ export const ModalContext = createContext<{
setShowUpgradePlanModal: () => {},
setShowImportBitlyModal: () => {},
setShowImportShortModal: () => {},
- setPollLinks: () => {},
});
export default function ModalProvider({ children }: { children: ReactNode }) {
@@ -85,26 +83,6 @@ export default function ModalProvider({ children }: { children: ReactNode }) {
}
}, [hashes]);
- // special link polling setup to poll links as they're being created (for bitly import)
- const [pollLinks, setPollLinks] = useState(false);
- useEffect(() => {
- if (pollLinks) {
- // if pollLinks is true, start polling links endpoint every 500 ms (stop after 20 seconds)
- const pollingInterval = setInterval(() => {
- mutate(
- (key) => typeof key === "string" && key.startsWith("/api/links"),
- undefined,
- { revalidate: true },
- );
- mutate(`/api/projects/${slug}/tags`);
- }, 500);
- setTimeout(() => {
- setPollLinks(false);
- clearInterval(pollingInterval);
- }, 20000);
- }
- }, [pollLinks]);
-
const { error } = useProject();
// handle invite and oauth modals
@@ -124,7 +102,6 @@ export default function ModalProvider({ children }: { children: ReactNode }) {
setShowUpgradePlanModal,
setShowImportBitlyModal,
setShowImportShortModal,
- setPollLinks,
}}
>
<AddProjectModal />