From 5b67f27345ae71298016f9788a9b9203d2a807fd Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Thu, 14 Dec 2023 19:55:45 +0530 Subject: [PATCH 1/4] fix: remove get requests from the catch block (#3135) * fix: refetching project filters on error * fix: get request in the catch block --- web/constants/swr-config.ts | 5 +++++ web/lib/app-provider.tsx | 5 ++++- web/store/issues/project-issues/cycle/filter.store.ts | 4 ++-- web/store/issues/project-issues/module/filter.store.ts | 4 ++-- web/store/issues/project-issues/project-view/filter.store.ts | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 web/constants/swr-config.ts diff --git a/web/constants/swr-config.ts b/web/constants/swr-config.ts new file mode 100644 index 000000000..063d5db54 --- /dev/null +++ b/web/constants/swr-config.ts @@ -0,0 +1,5 @@ +export const SWR_CONFIG = { + refreshWhenHidden: false, + revalidateIfStale: false, + errorRetryCount: 3, +}; diff --git a/web/lib/app-provider.tsx b/web/lib/app-provider.tsx index ba882f174..e9fd27e0a 100644 --- a/web/lib/app-provider.tsx +++ b/web/lib/app-provider.tsx @@ -12,6 +12,9 @@ import { THEMES } from "constants/themes"; import InstanceLayout from "layouts/instance-layout"; // contexts import { ToastContextProvider } from "contexts/toast.context"; +import { SWRConfig } from "swr"; +// constants +import { SWR_CONFIG } from "constants/swr-config"; // dynamic imports const StoreWrapper = dynamic(() => import("lib/wrappers/store-wrapper"), { ssr: false }); const PosthogWrapper = dynamic(() => import("lib/wrappers/posthog-wrapper"), { ssr: false }); @@ -48,7 +51,7 @@ export const AppProvider: FC = observer((props) => { posthogAPIKey={envConfig?.posthog_api_key || null} posthogHost={envConfig?.posthog_host || null} > - {children} + {children} diff --git a/web/store/issues/project-issues/cycle/filter.store.ts b/web/store/issues/project-issues/cycle/filter.store.ts index b78999d7e..bd7a76ce1 100644 --- a/web/store/issues/project-issues/cycle/filter.store.ts +++ b/web/store/issues/project-issues/cycle/filter.store.ts @@ -170,7 +170,7 @@ export class CycleIssuesFilterStore extends IssueFilterBaseStore implements ICyc return filters; } catch (error) { - this.fetchFilters(workspaceSlug, projectId, cycleId); + console.log("error in fetchCycleFilters", error); throw error; } }; @@ -215,7 +215,7 @@ export class CycleIssuesFilterStore extends IssueFilterBaseStore implements ICyc await this.fetchCycleFilters(workspaceSlug, projectId, cycleId); return; } catch (error) { - this.fetchFilters(workspaceSlug, projectId, cycleId); + console.log("error in cycleFetchFilters", error); throw error; } }; diff --git a/web/store/issues/project-issues/module/filter.store.ts b/web/store/issues/project-issues/module/filter.store.ts index 103528ba8..7f75cdd78 100644 --- a/web/store/issues/project-issues/module/filter.store.ts +++ b/web/store/issues/project-issues/module/filter.store.ts @@ -170,7 +170,7 @@ export class ModuleIssuesFilterStore extends IssueFilterBaseStore implements IMo return filters; } catch (error) { - this.fetchFilters(workspaceSlug, projectId, moduleId); + console.log("error in moduleFetchFilters", error); throw error; } }; @@ -216,7 +216,7 @@ export class ModuleIssuesFilterStore extends IssueFilterBaseStore implements IMo await this.fetchModuleFilters(workspaceSlug, projectId, moduleId); return; } catch (error) { - this.fetchFilters(workspaceSlug, projectId, moduleId); + console.log("error in projectFetchFilters", error); throw error; } }; diff --git a/web/store/issues/project-issues/project-view/filter.store.ts b/web/store/issues/project-issues/project-view/filter.store.ts index 215e3749f..e6c97809b 100644 --- a/web/store/issues/project-issues/project-view/filter.store.ts +++ b/web/store/issues/project-issues/project-view/filter.store.ts @@ -170,7 +170,7 @@ export class ViewIssuesFilterStore extends IssueFilterBaseStore implements IView return filters; } catch (error) { - this.fetchFilters(workspaceSlug, projectId, viewId); + console.log("error in viewFetchFilters", error); throw error; } }; @@ -216,7 +216,7 @@ export class ViewIssuesFilterStore extends IssueFilterBaseStore implements IView await this.fetchViewFilters(workspaceSlug, projectId, viewId); return; } catch (error) { - this.fetchFilters(workspaceSlug, projectId, viewId); + console.log("error in viewFetchFilters", error); throw error; } }; From 2edd2d947e808fd72c9b264fc9725189178dc32c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:39:32 +0530 Subject: [PATCH 2/4] chore: implement validation for accepting 'http://' and 'https://' url in link modal (#3147) --- web/components/core/modals/link-modal.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/components/core/modals/link-modal.tsx b/web/components/core/modals/link-modal.tsx index f80b58d33..9f0ec41bc 100644 --- a/web/components/core/modals/link-modal.tsx +++ b/web/components/core/modals/link-modal.tsx @@ -118,6 +118,7 @@ export const LinkModal: FC = (props) => { ref={ref} hasError={Boolean(errors.url)} placeholder="https://..." + pattern="^(https?://).*" className="w-full" /> )} From 829c08f0ee4aa59d5fbc9696f14ace081b00706a Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Fri, 15 Dec 2023 17:08:37 +0530 Subject: [PATCH 3/4] fix: making changes to sync job (#3149) --- .github/workflows/create-sync-pr.yml | 47 ++++++++-------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/.github/workflows/create-sync-pr.yml b/.github/workflows/create-sync-pr.yml index c8e27f322..b4e04374f 100644 --- a/.github/workflows/create-sync-pr.yml +++ b/.github/workflows/create-sync-pr.yml @@ -1,11 +1,13 @@ -name: Create PR in Plane EE Repository to sync the changes +name: Create Sync Action on: pull_request: branches: - - master + - develop # Change this to preview types: - closed +env: + SOURCE_BRANCH_NAME: ${{github.event.pull_request.base.ref}} jobs: create_pr: @@ -16,13 +18,6 @@ jobs: pull-requests: write contents: read steps: - - name: Check SOURCE_REPO - id: check_repo - env: - SOURCE_REPO: ${{ secrets.SOURCE_REPO_NAME }} - run: | - echo "::set-output name=is_correct_repo::$(if [[ "$SOURCE_REPO" == "makeplane/plane" ]]; then echo 'true'; else echo 'false'; fi)" - - name: Checkout Code if: steps.check_repo.outputs.is_correct_repo == 'true' uses: actions/checkout@v2 @@ -30,11 +25,6 @@ jobs: persist-credentials: false fetch-depth: 0 - - name: Set up Branch Name - if: steps.check_repo.outputs.is_correct_repo == 'true' - run: | - echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV - - name: Setup GH CLI if: steps.check_repo.outputs.is_correct_repo == 'true' run: | @@ -50,30 +40,19 @@ jobs: env: GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | - TARGET_REPO="${{ secrets.TARGET_REPO_NAME }}" - TARGET_BRANCH="${{ secrets.TARGET_REPO_BRANCH }}" + TARGET_REPO="${{ secrets.SYNC_TARGET_REPO_NAME }}" + TARGET_BRANCH="${{ secrets.SYNC_TARGET_BRANCH_NAME }}" + TARGET_BASE_BRANCH="${{ secrets.SYNC_TARGET_BASE_BRANCH_NAME }}" SOURCE_BRANCH="${{ env.SOURCE_BRANCH_NAME }}" git checkout $SOURCE_BRANCH - git remote add target "https://$GH_TOKEN@github.com/$TARGET_REPO.git" - git push target $SOURCE_BRANCH:$SOURCE_BRANCH + git remote add target-origin "https://$GH_TOKEN@github.com/$TARGET_REPO.git" + git push target-origin $SOURCE_BRANCH:$TARGET_BRANCH - PR_TITLE="${{ github.event.pull_request.title }}" - PR_BODY="${{ github.event.pull_request.body }}" - - # Remove double quotes - PR_TITLE_CLEANED="${PR_TITLE//\"/}" - PR_BODY_CLEANED="${PR_BODY//\"/}" - - # Construct PR_BODY_CONTENT using a here-document - PR_BODY_CONTENT=$(cat < Date: Fri, 15 Dec 2023 17:12:57 +0530 Subject: [PATCH 4/4] fix: removing unneccessary checks (#3150) --- .github/workflows/create-sync-pr.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/create-sync-pr.yml b/.github/workflows/create-sync-pr.yml index b4e04374f..0f85e940c 100644 --- a/.github/workflows/create-sync-pr.yml +++ b/.github/workflows/create-sync-pr.yml @@ -19,14 +19,12 @@ jobs: contents: read steps: - name: Checkout Code - if: steps.check_repo.outputs.is_correct_repo == 'true' uses: actions/checkout@v2 with: persist-credentials: false fetch-depth: 0 - name: Setup GH CLI - if: steps.check_repo.outputs.is_correct_repo == 'true' run: | type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg @@ -36,7 +34,6 @@ jobs: sudo apt install gh -y - name: Create Pull Request - if: steps.check_repo.outputs.is_correct_repo == 'true' env: GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: |