Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: workspace export settings mutation (#5268)

Anmol Singh Bhatia0b01d3e88d63
diff --git a/web/core/components/exporter/guide.tsx b/web/core/components/exporter/guide.tsx
index 7096555ec1..eff265a3ff 100644
--- a/web/core/components/exporter/guide.tsx
+++ b/web/core/components/exporter/guide.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { observer } from "mobx-react";
import Image from "next/image";
import Link from "next/link";
@@ -51,6 +51,11 @@ const IntegrationGuide = observer(() => {
: null
);
+ const handleRefresh = () => {
+ setRefreshing(true);
+ mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`)).then(() => setRefreshing(false));
+ };
+
const handleCsvClose = () => {
router.replace(`/${workspaceSlug?.toString()}/settings/exports`);
};
@@ -58,6 +63,18 @@ const IntegrationGuide = observer(() => {
const hasProjects = workspaceProjectIds && workspaceProjectIds.length > 0;
const isAdmin = currentWorkspaceRole === EUserWorkspaceRoles.ADMIN;
+ useEffect(() => {
+ const interval = setInterval(() => {
+ if (exporterServices?.results?.some((service) => service.status === "processing")) {
+ handleRefresh();
+ } else {
+ clearInterval(interval);
+ }
+ }, 3000);
+
+ return () => clearInterval(interval);
+ }, [exporterServices]);
+
return (
<>
<div className="h-full w-full">
@@ -103,12 +120,7 @@ const IntegrationGuide = observer(() => {
<button
type="button"
className="flex flex-shrink-0 items-center gap-1 rounded bg-custom-background-80 px-1.5 py-1 text-xs outline-none"
- onClick={() => {
- setRefreshing(true);
- mutate(EXPORT_SERVICES_LIST(workspaceSlug as string, `${cursor}`, `${per_page}`)).then(() =>
- setRefreshing(false)
- );
- }}
+ onClick={handleRefresh}
>
<RefreshCw className={`h-3 w-3 ${refreshing ? "animate-spin" : ""}`} />{" "}
{refreshing ? "Refreshing..." : "Refresh status"}