Skip to content

fix: scrolling glitch in environment#7732

Open
shubh-bruno wants to merge 3 commits intousebruno:mainfrom
shubh-bruno:fix/multiline-env
Open

fix: scrolling glitch in environment#7732
shubh-bruno wants to merge 3 commits intousebruno:mainfrom
shubh-bruno:fix/multiline-env

Conversation

@shubh-bruno
Copy link
Copy Markdown
Collaborator

@shubh-bruno shubh-bruno commented Apr 10, 2026

Description

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

Release Notes

  • New Features

    • Environment variable rows now automatically append when you edit the final row, streamlining data entry.
  • Style

    • Table height changes now animate smoothly.
  • Bug Fixes

    • Input placeholder text now displays appropriately based on field content.
    • Enhanced table rendering performance with improved virtualization and scrolling behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Walkthrough

This PR enhances the EnvironmentVariablesTable component with smooth height animations and improves virtualized table rendering. Changes include CSS transitions for animated height transitions, updated row wrapper prop handling, dynamic height calculations, overscan adjustments, and automatic empty row appending when editing the last variable's value.

Changes

Cohort / File(s) Summary
Styling Updates
packages/bruno-app/src/components/EnvironmentVariablesTable/StyledWrapper.js
Added CSS transition (height 0.15s ease) to .table-container for smooth animated height changes.
Virtualized Table Logic
packages/bruno-app/src/components/EnvironmentVariablesTable/index.js
Updated row wrapper to forward style props and use optional chaining for data-testid. Adjusted tableHeight computation from fixed minimum to dynamic calculation based on variable count. Added overscan={200} to TableVirtuoso and removed fixedItemHeight configuration. Refined input placeholders to depend on field-specific emptiness. Implemented auto-append logic that schedules a new empty variable row when the user edits the value in the last row.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

size/M

Suggested reviewers

  • helloanoop
  • bijin-bruno
  • lohit-bruno
  • sid-bruno

Poem

🎬 Tables dance with easing grace,
Heights transition without a trace,
Rows multiply when values flow,
Virtuoso spins the environment show,
Smooth animations steal the glow! ✨

🚥 Pre-merge checks | ✅ 3
✅ 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 main objective of the PR—fixing a scrolling glitch in the environment UI—and aligns with the commit messages and code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/EnvironmentVariablesTable/index.js (1)

22-33: ⚠️ Potential issue | 🟠 Major

Fix the TableRow shape: item is { variable, index }, not the raw variable.

TableVirtuoso passes each element from filteredVariables directly as the item prop. Since filteredVariables contains { variable, index } objects, accessing item.uid and item.name returns undefined. This collapses all row data-testid values to env-var-row-undefined, breaking test selectors. The memoization comparator then compares undefined === undefined for every row (always true), preventing necessary re-renders. Excluding style from the comparison also breaks Virtuoso's positioning logic.

Suggested fix
 const TableRow = React.memo(
   ({ children, item, style, ...rest }) => (
-    <tr key={item.uid} style={style} {...rest} data-testid={`env-var-row-${item?.name}`}>
+    <tr
+      style={style}
+      {...rest}
+      data-testid={`env-var-row-${item?.variable?.uid ?? item?.index}`}
+    >
       {children}
     </tr>
-  ),
-  (prevProps, nextProps) => {
-    const prevUid = prevProps?.item?.uid;
-    const nextUid = nextProps?.item?.uid;
-    return prevUid === nextUid && prevProps.children === nextProps.children;
-  }
+  )
 );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js` around
lines 22 - 33, TableRow currently treats item as the raw variable but
TableVirtuoso provides item as { variable, index }, causing uid/name to be
undefined and memoization to incorrectly block renders; update the render to
read const variable = item?.variable and use variable?.uid for the key and
variable?.name in data-testid, and update the memo comparator to compare
prevProps.item?.variable?.uid !== nextProps.item?.variable?.uid (or equality)
plus prevProps.children === nextProps.children AND prevProps.style ===
nextProps.style so style changes from Virtuoso still trigger re-renders.
🧹 Nitpick comments (1)
packages/bruno-app/src/components/EnvironmentVariablesTable/index.js (1)

627-628: Please rewrite or remove this inline note.

The sentence is hard to parse and already stale: it mentions 0.1s, while the new height transition is 0.15s. If this is a real follow-up, capture the concrete layout constraint instead of leaving a half-formed note.

As per coding guidelines "Add in meaningful comments instead of obvious ones where complex code flow is explained properly."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js` around
lines 627 - 628, The inline dev note in the EnvironmentVariablesTable component
about button placement is stale and unclear—remove it or replace it with a
concise, actionable comment that documents the real layout constraint:
TableVirtuoso's height transition (0.15s) can cause buttons inside the virtuoso
container to reflow during mount, so either render action buttons outside the
TableVirtuoso virtualization container or use a stable positioning strategy
(e.g., position: sticky/fixed or a separate toolbar) to avoid transition-driven
layout shifts; update the comment to reference TableVirtuoso and the 0.15s
transition and include the chosen mitigation so future maintainers know why the
buttons are placed where they are.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js`:
- Around line 563-565: The placeholder logic in EnvironmentVariablesTable treats
falsy values like 0 and false as empty because it uses !variable.value; update
the placeholder expression to only consider null/undefined or blank strings as
empty. Specifically, replace the !variable.value check in the placeholder prop
for the variable.value field with an explicit check like variable.value ===
undefined || variable.value === null || (typeof variable.value === 'string' &&
variable.value.trim() === '') so numeric 0 and boolean false are preserved as
real values.

---

Outside diff comments:
In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js`:
- Around line 22-33: TableRow currently treats item as the raw variable but
TableVirtuoso provides item as { variable, index }, causing uid/name to be
undefined and memoization to incorrectly block renders; update the render to
read const variable = item?.variable and use variable?.uid for the key and
variable?.name in data-testid, and update the memo comparator to compare
prevProps.item?.variable?.uid !== nextProps.item?.variable?.uid (or equality)
plus prevProps.children === nextProps.children AND prevProps.style ===
nextProps.style so style changes from Virtuoso still trigger re-renders.

---

Nitpick comments:
In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js`:
- Around line 627-628: The inline dev note in the EnvironmentVariablesTable
component about button placement is stale and unclear—remove it or replace it
with a concise, actionable comment that documents the real layout constraint:
TableVirtuoso's height transition (0.15s) can cause buttons inside the virtuoso
container to reflow during mount, so either render action buttons outside the
TableVirtuoso virtualization container or use a stable positioning strategy
(e.g., position: sticky/fixed or a separate toolbar) to avoid transition-driven
layout shifts; update the comment to reference TableVirtuoso and the 0.15s
transition and include the chosen mitigation so future maintainers know why the
buttons are placed where they are.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5ba89434-5814-477e-9b21-ae763bdc0495

📥 Commits

Reviewing files that changed from the base of the PR and between cd06f28 and 50869d4.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/EnvironmentVariablesTable/StyledWrapper.js
  • packages/bruno-app/src/components/EnvironmentVariablesTable/index.js

Comment on lines 563 to 565
value={variable.value}
placeholder={isLastEmptyRow ? 'Value' : ''}
placeholder={!variable.value || (typeof variable.value === 'string' && variable.value.trim() === '') ? 'Value' : ''}
isSecret={variable.secret}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Don't treat 0 and false as empty values here.

!variable.value sends legitimate falsy env values down the placeholder branch. That makes script-set values like 0 and false look empty even though they are valid values.

Suggested fix
-                      placeholder={!variable.value || (typeof variable.value === 'string' && variable.value.trim() === '') ? 'Value' : ''}
+                      placeholder={
+                        variable.value == null || (typeof variable.value === 'string' && variable.value.trim() === '')
+                          ? 'Value'
+                          : ''
+                      }

Based on learnings "falsy values are legitimate environment variable values and should not be filtered out."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js` around
lines 563 - 565, The placeholder logic in EnvironmentVariablesTable treats falsy
values like 0 and false as empty because it uses !variable.value; update the
placeholder expression to only consider null/undefined or blank strings as
empty. Specifically, replace the !variable.value check in the placeholder prop
for the variable.value field with an explicit check like variable.value ===
undefined || variable.value === null || (typeof variable.value === 'string' &&
variable.value.trim() === '') so numeric 0 and boolean false are preserved as
real values.

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.

1 participant