flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

fix: save feature error handling

Open kyle-ssg opened this issue 1 year ago • 8 comments

Thanks for submitting a PR! Please check the boxes below:

  • [x] I have run pre-commit to check linting
  • [x] I have added information to docs/ if required so people know about the feature!
  • [x] I have filled in the "Changes" section below?
  • [x] I have filled in the "How did you test this code" section below?
  • [x] I have used a Conventional Commit title for this Pull Request

Changes

Tracks and displays errors when saving a feature.

How did you test this code?

  • Created a feature with a duplicate name
  • Attempted to save a feature whilst offline

kyle-ssg avatar May 30 '24 14:05 kyle-ssg

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 4:46pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 4:46pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Aug 7, 2024 4:46pm

vercel[bot] avatar May 30 '24 14:05 vercel[bot]

Uffizzi Preview deployment-53952 was deleted.

github-actions[bot] avatar May 30 '24 14:05 github-actions[bot]

I'm still able to reproduce https://github.com/Flagsmith/flagsmith/issues/4025 on this preview environment:

https://github.com/Flagsmith/flagsmith/assets/829698/ad625a1e-abb9-45b7-afad-65dbac56b2a2

(#4025 is about the 404 error, this issue is about the error not being displayed and the save button not being re-enabled after an error)

rolodato avatar May 30 '24 15:05 rolodato

Thats just because the PR doesnt have the latest main, the PRs were all up at the same time.

The preview url will now contain the other changes from yesterday.

kyle-ssg avatar May 31 '24 08:05 kyle-ssg

@rolodato This can be re-tested

kyle-ssg avatar Jun 04 '24 07:06 kyle-ssg

Tested again, this works:

  • Creating a feature with a duplicate name
  • Updating a feature twice on a versioning v2 environment, without closing the modal

This doesn't work:

  • Creating a feature while offline - no error message is shown and the Create button is never re-enabled
  • Updating a feature while offline - same as above

https://github.com/Flagsmith/flagsmith/assets/829698/e17729f6-0ab4-4a12-92e4-e20c76d89756

rolodato avatar Jun 04 '24 20:06 rolodato

@rolodato can I just check you're testing on the right url ? Strangely the url in your video doesn't have the branch name in it.

Failing that, I suppose it could be that your browser is retrying/trying to connect the request whilst offline in which case I can't intercept it.

Regardless, here's what I'm seeing on the above.

https://github.com/Flagsmith/flagsmith/assets/8608314/00b5da8b-649f-4415-b061-af6ce8a0d61b

kyle-ssg avatar Jun 19 '24 15:06 kyle-ssg

@kyle-ssg I tried visiting the preview URL from your video (https://flagsmith-frontend-preview-git-fix-save-featur-1e23c8-flagsmith.vercel.app) and I still get the same behaviour when trying to create a feature in Firefox with "Work Offline" enabled, or in Chromium when setting the devtools Network throttling mode to "Offline". I see the same ERR_INTERNET_DISCONNECTED errors as you, but in my case no error is shown in the UI and the "Create Feature" or "Update Feature" buttons are never re-enabled.

Digging deeper I've found why this is working for you - you're trying to update a feature in a versioning-v1 environment. This also shows an error for me as expected. However, these all fail with no error message and the buttons are never re-enabled:

  • Create a feature in a v1 environment
  • Create a feature in a v2 environment
  • Update a feature in a v2 environment

Hopefully this video makes it clearer:

https://github.com/Flagsmith/flagsmith/assets/829698/34d180a0-4f12-4be4-9aed-81b4670c3c75

rolodato avatar Jun 21 '24 18:06 rolodato

@kyle-ssg were you able to take a look at my comment above?

rolodato avatar Jul 08 '24 11:07 rolodato

flagsmith image build and security scan finished :sparkles:

Image Build Status Security report
ghcr.io/flagsmith/flagsmith:pr-4058 Finished :white_check_mark: Results :white_check_mark:

github-actions[bot] avatar Jul 08 '24 15:07 github-actions[bot]

flagsmith-frontend image build and security scan finished :sparkles:

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-frontend:pr-4058 Finished :white_check_mark: Results :white_check_mark:

github-actions[bot] avatar Jul 08 '24 15:07 github-actions[bot]

flagsmith-api image build and security scan finished :sparkles:

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api:pr-4058 Finished :white_check_mark: Results :white_check_mark:

github-actions[bot] avatar Jul 08 '24 15:07 github-actions[bot]

flagsmith-e2e image build finished :sparkles:

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-4058 Finished :white_check_mark: Skipped

github-actions[bot] avatar Jul 08 '24 15:07 github-actions[bot]

flagsmith-private-cloud image build and security scan finished :sparkles:

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4058 Finished :white_check_mark: Results :white_check_mark:

github-actions[bot] avatar Jul 08 '24 15:07 github-actions[bot]

Should be resolved @rolodato , I believe this was only fixed for non-versioned environments before.

kyle-ssg avatar Jul 08 '24 15:07 kyle-ssg

Updating works with or without feature versioning, but I get the same behaviour (create button never re-enabled) when creating features on your latest changes.

rolodato avatar Jul 10 '24 21:07 rolodato

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-4058 Finished :white_check_mark: Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-4058 Finished :white_check_mark: Skipped
ghcr.io/flagsmith/flagsmith-api:pr-4058 Finished :white_check_mark: Results :white_check_mark:
ghcr.io/flagsmith/flagsmith:pr-4058 Finished :white_check_mark: Results :white_check_mark:
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4058 Finished :white_check_mark: Results :white_check_mark:
ghcr.io/flagsmith/flagsmith-frontend:pr-4058 Finished :white_check_mark: Results :white_check_mark:

github-actions[bot] avatar Jul 24 '24 18:07 github-actions[bot]

@rolodato I've added error handling for create flag

kyle-ssg avatar Jul 24 '24 18:07 kyle-ssg

Going to merge this, any follow up issues can be a separate ticket.

kyle-ssg avatar Jul 31 '24 10:07 kyle-ssg

@kyle-ssg apologies for the late reply - I do see an error when trying to create a duplicate feature now, but the error message shown is [object Object]:

image

Looking at https://flagsmith-frontend-staging-git-fix-save-featur-5a4f48-flagsmith.vercel.app/project/6111/environment/apzb2ZhCSF5jcfC7udhnLB/features

rolodato avatar Jul 31 '24 15:07 rolodato

@rolodato I promise this is the last time 😄

kyle-ssg avatar Aug 07 '24 16:08 kyle-ssg