Skip to content

fix: initialize selected environment correctly to prevent flicker #6536

Merged
bijin-bruno merged 1 commit intousebruno:mainfrom
abhishek-bruno:fix/collection-env-flicker-issue
Dec 29, 2025
Merged

fix: initialize selected environment correctly to prevent flicker #6536
bijin-bruno merged 1 commit intousebruno:mainfrom
abhishek-bruno:fix/collection-env-flicker-issue

Conversation

@abhishek-bruno
Copy link
Member

@abhishek-bruno abhishek-bruno commented Dec 29, 2025

Description

Initialize selected environment correctly to prevent flicker in EnvironmentSettings component; remove transition from StyledWrapper in RequestTabs and WorkspaceTabs

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed environment selection initialization to properly account for the active environment setting and collection configuration.
  • Style

    • Removed transition animations from tab components, making background-color changes on request and workspace tabs instantaneous rather than animated.

✏️ Tip: You can customize this high-level summary in your review settings.

…EnvironmentSettings component; remove transition from StyledWrapper in RequestTabs and WorkspaceTabs
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Walkthrough

Three targeted improvements: a computed initialization strategy for selected environment that respects the active environment UID and defaults intelligently, plus removal of CSS transitions from tab components for instantaneous background-color updates.

Changes

Cohort / File(s) Summary
Environment Initialization Logic
packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
Refactored selectedEnvironment state initialization with a lazy initializer function that returns null if no environments exist, otherwise selects the environment matching activeEnvironmentUid or defaults to the first environment. Moved environments array extraction before initialization and removed duplicate declaration.
Tab Transition Styling
packages/bruno-app/src/components/RequestTabs/StyledWrapper.js, packages/bruno-app/src/components/WorkspaceTabs/StyledWrapper.js
Removed transition: background-color 0.15s ease; from tab list item styles in both files, resulting in instantaneous background-color updates on state changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • usebruno/bruno#6407: Modifies the same EnvironmentSettings/index.js file with environment array derivation and selectedEnvironment initialization logic.
  • usebruno/bruno#6456: Updates WorkspaceTabs/StyledWrapper.js with tab styling changes.
  • usebruno/bruno#6372: Modifies RequestTabs/StyledWrapper.js with tab styling adjustments.

Suggested reviewers

  • lohit-bruno
  • helloanoop
  • naman-bruno

Poem

🎨 Environments now remember their place,
With logic that's graceful and smooth as a space—
While tabs snap to life without a delay,
Their transitions dissolved, making clicks feel less gray! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary fix: initializing the selected environment correctly to prevent flicker, which aligns with the main change in EnvironmentSettings/index.js and the removal of transitions in StyledWrapper files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js (1)

36-36: Redundant null check.

The condition !environments is redundant since line 27 ensures environments is always an array ([] at minimum). You can simplify to just check the length.

🔎 Proposed simplification
-  if (!environments || !environments.length) {
+  if (!environments.length) {
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c714e9b and e3b99c3.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
  • packages/bruno-app/src/components/RequestTabs/StyledWrapper.js
  • packages/bruno-app/src/components/WorkspaceTabs/StyledWrapper.js
💤 Files with no reviewable changes (2)
  • packages/bruno-app/src/components/WorkspaceTabs/StyledWrapper.js
  • packages/bruno-app/src/components/RequestTabs/StyledWrapper.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
🧠 Learnings (1)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Unit Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (1)
packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js (1)

27-32: LGTM! Smart initialization to prevent flicker.

The lazy-initialized selectedEnvironment correctly computes the initial value by matching activeEnvironmentUid or falling back to the first environment. Moving the environments extraction before the state initialization ensures the correct value is available during the initial render, eliminating the flicker.

@bijin-bruno bijin-bruno merged commit 1b57b6b into usebruno:main Dec 29, 2025
8 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 28, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants