fix: save feature error handling
Thanks for submitting a PR! Please check the boxes below:
- [x] I have run
pre-committo 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
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 |
Uffizzi Preview deployment-53952 was deleted.
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)
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.
@rolodato This can be re-tested
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 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 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
@kyle-ssg were you able to take a look at my comment above?
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: |
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: |
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: |
flagsmith-e2e image build finished :sparkles:
| Image | Build Status | Security report |
|---|---|---|
ghcr.io/flagsmith/flagsmith-e2e:pr-4058 |
Finished :white_check_mark: | Skipped |
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: |
Should be resolved @rolodato , I believe this was only fixed for non-versioned environments before.
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.
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: |
@rolodato I've added error handling for create flag
Going to merge this, any follow up issues can be a separate ticket.
@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]:
Looking at https://flagsmith-frontend-staging-git-fix-save-featur-5a4f48-flagsmith.vercel.app/project/6111/environment/apzb2ZhCSF5jcfC7udhnLB/features
@rolodato I promise this is the last time 😄