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: description state management in EnvironmentSettingsPage #4917

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tiagoapolo
Copy link
Contributor

@tiagoapolo tiagoapolo commented Dec 12, 2024

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

  • 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

  • Checks for roles empty list
  • Fix description field state management, conflicting value from what comes from the backend and what is stored in the component's state

Before

not_fixed.mov

After

fixed.mov

How did you test this code?

Please describe.

@tiagoapolo tiagoapolo requested a review from a team as a code owner December 12, 2024 15:40
@tiagoapolo tiagoapolo requested review from kyle-ssg and removed request for a team December 12, 2024 15:40
Copy link

vercel bot commented Dec 12, 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 Dec 12, 2024 3:40pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 3:40pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Dec 12, 2024 3:40pm

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard fix labels Dec 12, 2024
Copy link
Contributor

github-actions bot commented Dec 12, 2024

Docker builds report

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

@tiagoapolo tiagoapolo requested review from zachaysan, matthewelwell, a team and kyle-ssg and removed request for kyle-ssg and a team December 12, 2024 15:40
Copy link
Contributor

github-actions bot commented Dec 12, 2024

Uffizzi Ephemeral Environment deployment-59060

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/4917

📄 View Application Logs etc.

What is Uffizzi? Learn more!

@@ -61,7 +61,7 @@ const EnvironmentSettingsPage = class extends Component {
const env = ProjectStore.getEnvs().find(
(v) => v.api_key === this.props.match.params.environmentId,
)
this.setState({ env })
this.setState({ env, description: env.description ?? "" })
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm interested to know why description has to be handled differently? Shouldn't it just be updated as part of the environment object? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My approach here was to make sure we're consistent in how we're getting and updating the data from, previously we were mixing internal states with context one, which in my opinion is more confusing and prone to bugs. So, either using environment object or description internal states is fine.

  value={
    typeof this.state.description === 'string'
      ? this.state.description
      : env.description
  }

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.

3 participants