Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: save feature error handling #4058

Merged
merged 8 commits into from
Aug 13, 2024
Merged

Conversation

kyle-ssg
Copy link
Member

@kyle-ssg kyle-ssg commented May 30, 2024

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

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • 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

Copy link

vercel bot commented May 30, 2024

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

Copy link
Contributor

github-actions bot commented May 30, 2024

Uffizzi Preview deployment-53952 was deleted.

@kyle-ssg kyle-ssg requested a review from rolodato May 30, 2024 14:58
@rolodato
Copy link
Member

I'm still able to reproduce #4025 on this preview environment:

update.stuck.mov

(#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)

@kyle-ssg
Copy link
Member Author

kyle-ssg commented May 31, 2024

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.

# Conflicts:
#	frontend/common/stores/feature-list-store.ts
@kyle-ssg
Copy link
Member Author

kyle-ssg commented Jun 4, 2024

@rolodato This can be re-tested

@rolodato
Copy link
Member

rolodato commented Jun 4, 2024

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
create.feature.offline.mov

@kyle-ssg
Copy link
Member Author

kyle-ssg commented Jun 19, 2024

@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.

offline.mov

@rolodato
Copy link
Member

@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:

features.offline.mov

@rolodato
Copy link
Member

rolodato commented Jul 8, 2024

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

Copy link
Contributor

github-actions bot commented Jul 8, 2024

flagsmith-e2e image build finished ✨

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

Copy link
Contributor

github-actions bot commented Jul 8, 2024

flagsmith-private-cloud image build and security scan finished ✨

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

@kyle-ssg
Copy link
Member Author

kyle-ssg commented Jul 8, 2024

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

Copy link
Contributor

@novakzaballa novakzaballa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No error is displayed when attempting to create a new feature offline, all other cases appear covered.

@rolodato
Copy link
Member

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.

@github-actions github-actions bot added fix and removed fix labels Jul 24, 2024
Copy link
Contributor

github-actions bot commented Jul 24, 2024

Docker builds report

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

@kyle-ssg
Copy link
Member Author

@rolodato I've added error handling for create flag

@kyle-ssg
Copy link
Member Author

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

@kyle-ssg kyle-ssg enabled auto-merge July 31, 2024 10:39
@rolodato
Copy link
Member

@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

@kyle-ssg
Copy link
Member Author

kyle-ssg commented Aug 7, 2024

@rolodato I promise this is the last time 😄

Copy link
Member

@rolodato rolodato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved - found one more preexisting bug if you'd like to fix it in this same PR:

  1. Try to create a feature with a duplicate name, get an error
  2. Close the "new feature" modal
  3. Edit any feature - the error from step 1 is shown here
error.create.feature.mov

@kyle-ssg kyle-ssg added this pull request to the merge queue Aug 13, 2024
Merged via the queue into main with commit 2517e9d Aug 13, 2024
31 checks passed
@kyle-ssg kyle-ssg deleted the fix/save-feature-error-handling branch August 13, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Save" button in modals is never re-enabled in case of failure
3 participants