From 24894e05dcf6b46715c4b1db8087e83da0d07490 Mon Sep 17 00:00:00 2001 From: Nivedin <53208152+nivedin@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:04:07 +0530 Subject: [PATCH] fix: shortcode resolution screen is stuck on invalid shortcodes (#3142) Co-authored-by: Andrew Bastin --- .github/workflows/ui.yml | 42 +++++++++++++++++++ .../hoppscotch-common/src/pages/r/_id.vue | 13 ++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/ui.yml diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml new file mode 100644 index 0000000000..cc82cd9547 --- /dev/null +++ b/.github/workflows/ui.yml @@ -0,0 +1,42 @@ +name: Deploy to Netlify (ui) + +on: + push: + branches: [main] + # run this workflow only if an update is made to the ui package + paths: + - "packages/hoppscotch-ui/**" + workflow_dispatch: + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup environment + run: mv .env.example .env + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8 + run_install: true + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: pnpm + + - name: Build site + run: pnpm run generate-ui + + # Deploy the ui site with netlify-cli + - name: Deploy to Netlify (ui) + run: npx netlify-cli deploy --dir=packages/hoppscotch-ui/.histoire/dist --prod + env: + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_UI_SITE_ID }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} diff --git a/packages/hoppscotch-common/src/pages/r/_id.vue b/packages/hoppscotch-common/src/pages/r/_id.vue index 64b917981e..70155ce0b6 100644 --- a/packages/hoppscotch-common/src/pages/r/_id.vue +++ b/packages/hoppscotch-common/src/pages/r/_id.vue @@ -11,6 +11,14 @@

{{ t("error.invalid_link_description") }}

+

+ +

{ const data = shortcodeDetails.data if (E.isRight(data)) { + if (!data.right.shortcode?.request) { + invalidLink.value = true + return + } + const request: unknown = JSON.parse(data.right.shortcode?.request as string) createNewTab({