Skip to content

Conversation

@guruswarupa
Copy link
Contributor

@guruswarupa guruswarupa commented Jan 7, 2026

Issue

  • fix env variable overflow
  • fix ui quirk due to useEffect
  • remove scrolling and allow flow vertically

Scope of Change

Select all applicable areas impacted by this PR:

  • View (UI/UX)
  • API
  • CLI
  • Infra / Deployment
  • Docs
  • Other (specify): ________

Screenshot / Video / GIF (if applicable)

image

Developer Checklist

To be completed by the developer who raised the PR.

  • Add valid/relevant title for the PR
  • Self-review done
  • Manual dev testing done
  • No secrets exposed
  • No merge conflicts
  • Docs added/updated (if applicable)
  • Removed debug prints / secrets / sensitive data
  • Unit / Integration tests passing
  • Follows all standards defined in Nixopus Docs

Reviewer Checklist

To be completed by the reviewer before merge.

  • Peer review done
  • No console.logs / fmt.prints left
  • No secrets exposed
  • If any DB migrations, migration changes are verified
  • Verified release changes are production-ready

Summary by CodeRabbit

Release Notes

  • Style

    • Standardized text truncation across environment variable input fields and displays.
    • Improved layout handling for variables in tight spaces.
    • Enhanced secret variable styling with refined title display behavior.
  • Bug Fixes

    • Fixed unintended re-initialization of the environment variables editor on prop changes.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

The pull request improves environment variable editor UI with standardized truncation styling via a new INPUT_TRUNCATE constant, replaces ScrollArea-based layout with a simpler scrollable container, and enhances key/value display responsiveness. Additionally, a useRef-based initialization guard is added to the editor hook to prevent re-initialization on subsequent renders.

Changes

Cohort / File(s) Summary
UI Component Refactoring
view/components/ui/env-variables-editor.tsx
Introduces INPUT_TRUNCATE constant for standardized text truncation. Replaces ScrollArea layout with overflow-y-auto container and adds min-w-0 constraints to enable proper truncation. Enhances key/value display spans with responsive max-width styling and adjusts title visibility for secrets. Applies truncation styling to edit mode inputs while preserving existing action buttons.
Hook Initialization Guard
view/hooks/use-env-variables-editor.ts
Adds useRef-based hasInitialized guard to prevent re-initialization on subsequent renders. Moves initialization logic into effect to execute only once when defaultValues is populated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

nixopus-view, Review effort 2/5

Poem

🐰 A truncate constant hops on by,
ScrollAreas fade, new layouts fly!
Initialization guards keep things neat,
Responsive widths make the view complete! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix environment variable configuration section in self-host' directly aligns with the primary changes: addressing environment variable overflow, fixing UI quirks in the env-variables-editor component, and improving layout for the environment variable configuration section.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@guruswarupa guruswarupa changed the base branch from master to feat/develop January 7, 2026 18:46
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: 1

🤖 Fix all issues with AI agents
In @view/components/ui/env-variables-editor.tsx:
- Around line 145-159: The span currently sets title={variable.value}
unconditionally, which exposes secrets; modify the JSX in the span that renders
variable.value (the element using variable.isSecret, isRevealed, and maskValue)
so the title attribute is only present when the value is not secret or when it
is revealed (e.g., conditionally include title={variable.value} only if
!variable.isSecret || isRevealed); also consider removing the title entirely for
masked values to prevent tooltip leaks and optionally simplify the className
template literal formatting for readability.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bca1c8 and b7f00be.

📒 Files selected for processing (62)
  • api/templates/deploy-airsonic-advanced.yaml
  • api/templates/deploy-alist.yaml
  • api/templates/deploy-altus.yaml
  • api/templates/deploy-ardour.yaml
  • api/templates/deploy-audacity.yaml
  • api/templates/deploy-bambustudio.yaml
  • api/templates/deploy-blender.yaml
  • api/templates/deploy-boinc.yaml
  • api/templates/deploy-brave.yaml
  • api/templates/deploy-calligra.yaml
  • api/templates/deploy-chrome.yaml
  • api/templates/deploy-chromium.yaml
  • api/templates/deploy-cura.yaml
  • api/templates/deploy-darktable.yaml
  • api/templates/deploy-digikam.yaml
  • api/templates/deploy-dolphin.yaml
  • api/templates/deploy-doublecommander.yaml
  • api/templates/deploy-duckstation.yaml
  • api/templates/deploy-faster-whisper.yaml
  • api/templates/deploy-ferdium.yaml
  • api/templates/deploy-ffmpeg.yaml
  • api/templates/deploy-filezilla.yaml
  • api/templates/deploy-firefox.yaml
  • api/templates/deploy-foldingathome.yaml
  • api/templates/deploy-freecad.yaml
  • api/templates/deploy-gimp.yaml
  • api/templates/deploy-gzdoom.yaml
  • api/templates/deploy-hishtory-server.yaml
  • api/templates/deploy-htpcmanager.yaml
  • api/templates/deploy-inkscape.yaml
  • api/templates/deploy-jackett.yaml
  • api/templates/deploy-joplin.yaml
  • api/templates/deploy-kali-linux.yaml
  • api/templates/deploy-kasm.yaml
  • api/templates/deploy-kavita.yaml
  • api/templates/deploy-kdenlive.yaml
  • api/templates/deploy-keepassxc.yaml
  • api/templates/deploy-kicad.yaml
  • api/templates/deploy-krita.yaml
  • api/templates/deploy-lazylibrarian.yaml
  • api/templates/deploy-librewolf.yaml
  • api/templates/deploy-limnoria.yaml
  • api/templates/deploy-lollypop.yaml
  • api/templates/deploy-luanti.yaml
  • api/templates/deploy-mame.yaml
  • api/templates/deploy-mediaelch.yaml
  • api/templates/deploy-medusa.yaml
  • api/templates/deploy-minisatip.yaml
  • api/templates/deploy-monica.yaml
  • api/templates/deploy-msedge.yaml
  • api/templates/deploy-mstream.yaml
  • api/templates/deploy-mullvad-browser.yaml
  • api/templates/deploy-myspeed.yaml
  • api/templates/deploy-netbootxyz.yaml
  • api/templates/deploy-opengist.yaml
  • api/templates/deploy-redisinsight.yaml
  • api/templates/deploy-slash.yaml
  • api/templates/deploy-stirling-pdf.yaml
  • api/templates/deploy-taskmd.yaml
  • api/templates/deploy-url-to-png.yaml
  • view/components/ui/env-variables-editor.tsx
  • view/hooks/use-env-variables-editor.ts
💤 Files with no reviewable changes (60)
  • api/templates/deploy-ffmpeg.yaml
  • api/templates/deploy-lazylibrarian.yaml
  • api/templates/deploy-url-to-png.yaml
  • api/templates/deploy-calligra.yaml
  • api/templates/deploy-chrome.yaml
  • api/templates/deploy-redisinsight.yaml
  • api/templates/deploy-brave.yaml
  • api/templates/deploy-digikam.yaml
  • api/templates/deploy-netbootxyz.yaml
  • api/templates/deploy-airsonic-advanced.yaml
  • api/templates/deploy-kasm.yaml
  • api/templates/deploy-firefox.yaml
  • api/templates/deploy-gzdoom.yaml
  • api/templates/deploy-mstream.yaml
  • api/templates/deploy-altus.yaml
  • api/templates/deploy-myspeed.yaml
  • api/templates/deploy-monica.yaml
  • api/templates/deploy-mame.yaml
  • api/templates/deploy-medusa.yaml
  • api/templates/deploy-lollypop.yaml
  • api/templates/deploy-jackett.yaml
  • api/templates/deploy-kdenlive.yaml
  • api/templates/deploy-filezilla.yaml
  • api/templates/deploy-minisatip.yaml
  • api/templates/deploy-dolphin.yaml
  • api/templates/deploy-kicad.yaml
  • api/templates/deploy-mullvad-browser.yaml
  • api/templates/deploy-duckstation.yaml
  • api/templates/deploy-audacity.yaml
  • api/templates/deploy-limnoria.yaml
  • api/templates/deploy-kali-linux.yaml
  • api/templates/deploy-faster-whisper.yaml
  • api/templates/deploy-slash.yaml
  • api/templates/deploy-darktable.yaml
  • api/templates/deploy-taskmd.yaml
  • api/templates/deploy-stirling-pdf.yaml
  • api/templates/deploy-opengist.yaml
  • api/templates/deploy-bambustudio.yaml
  • api/templates/deploy-freecad.yaml
  • api/templates/deploy-librewolf.yaml
  • api/templates/deploy-mediaelch.yaml
  • api/templates/deploy-chromium.yaml
  • api/templates/deploy-doublecommander.yaml
  • api/templates/deploy-kavita.yaml
  • api/templates/deploy-ardour.yaml
  • api/templates/deploy-alist.yaml
  • api/templates/deploy-krita.yaml
  • api/templates/deploy-blender.yaml
  • api/templates/deploy-inkscape.yaml
  • api/templates/deploy-ferdium.yaml
  • api/templates/deploy-gimp.yaml
  • api/templates/deploy-htpcmanager.yaml
  • api/templates/deploy-joplin.yaml
  • api/templates/deploy-cura.yaml
  • api/templates/deploy-foldingathome.yaml
  • api/templates/deploy-msedge.yaml
  • api/templates/deploy-keepassxc.yaml
  • api/templates/deploy-boinc.yaml
  • api/templates/deploy-hishtory-server.yaml
  • api/templates/deploy-luanti.yaml
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

**/*.{ts,tsx}: Before writing any new logic, search the codebase for existing implementations in view/hooks/, view/lib/utils.ts, view/components/ui/, and view/redux/services/ before creating custom elements
Extract repeated patterns into custom hooks or shared components
Use early returns and flat structure instead of nested conditions for improved code readability
Always use typed hooks useAppDispatch and useAppSelector from @/redux/hooks instead of untyped useDispatch and useSelector
Never use any type; always use explicit types for function parameters and return values
Remove unused imports immediately and delete commented-out code
Keep files focused and minimal by removing unused variables and functions
In comments, explain WHY code works a certain way, not WHAT it does
Never disable lint rules without strong justification

Files:

  • view/components/ui/env-variables-editor.tsx
  • view/hooks/use-env-variables-editor.ts
view/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

view/**/*.{tsx,ts}: Each component file should export one main component
Never write plain HTML for interactive elements; always use shadcn components like Button, Card, Badge, Skeleton
Use the cn() utility function for conditional Tailwind classes
No hardcoded user-facing strings; always use i18n with the useTranslation hook
Handle loading states by checking isLoading from RTK Query and returning skeleton loaders or loading components
Handle error states by checking error values from RTK Query and displaying error messages using i18n
Show empty state UI when data is empty using i18n messages
Always provide skeleton loaders for async content instead of blank/white space
Use semantic HTML elements for accessibility
Provide proper ARIA labels where needed for accessibility
Memoize expensive computations with useMemo
Prevent unnecessary re-renders with useCallback
Use React Query's caching effectively to avoid redundant API calls
Lazy load heavy components when appropriate
Ensure responsive design works on all screen sizes

Files:

  • view/components/ui/env-variables-editor.tsx
  • view/hooks/use-env-variables-editor.ts
view/components/ui/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

Do not modify components in view/components/ui/ (shadcn base components)

Files:

  • view/components/ui/env-variables-editor.tsx
view/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

view/**/*.{ts,tsx}: Respect ESLint rules configured in view/eslint.config.mjs
Use Prettier for consistent formatting and fix all lint errors before committing

Files:

  • view/components/ui/env-variables-editor.tsx
  • view/hooks/use-env-variables-editor.ts
view/hooks/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

view/hooks/**/*.ts: Use generic patterns for typed hooks to handle type-safe data manipulation
Use JSDoc comments for complex hooks and functions to explain their purpose and parameters

Files:

  • view/hooks/use-env-variables-editor.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: raghavyuva
Repo: raghavyuva/nixopus PR: 0
File: :0-0
Timestamp: 2025-09-14T14:31:19.830Z
Learning: The update functionality in Nixopus has a critical issue where environment variables are not properly exported to containers during updates. This causes health checks in the compose file to gradually hit Postgres, eventually killing it and causing it to enter recovery mode, leading to unexpected termination and cleaning of production database tables - a severe data loss issue.
Learnt from: raghavyuva
Repo: raghavyuva/nixopus PR: 0
File: :0-0
Timestamp: 2025-09-14T14:31:19.830Z
Learning: The Nixopus update functionality has a critical flaw: the update process in cli/app/commands/update/run.py calls BaseDockerService for "pull" and "up" operations without passing the env_file parameter. This causes containers to start without environment variables, leading to health check failures. Specifically, the Postgres health check "pg_isready -U ${USERNAME} -d ${DB_NAME}" fails when USERNAME and DB_NAME environment variables are missing, eventually causing Postgres to enter recovery mode and potentially lose production data.
📚 Learning: 2025-12-27T03:02:43.092Z
Learnt from: CR
Repo: raghavyuva/nixopus PR: 0
File: .cursor/rules/frontend.mdc:0-0
Timestamp: 2025-12-27T03:02:43.092Z
Learning: Applies to **/*.{ts,tsx} : Keep files focused and minimal by removing unused variables and functions

Applied to files:

  • view/components/ui/env-variables-editor.tsx
📚 Learning: 2025-12-27T03:02:43.092Z
Learnt from: CR
Repo: raghavyuva/nixopus PR: 0
File: .cursor/rules/frontend.mdc:0-0
Timestamp: 2025-12-27T03:02:43.092Z
Learning: Applies to view/**/*.{tsx,ts} : Never write plain HTML for interactive elements; always use shadcn components like Button, Card, Badge, Skeleton

Applied to files:

  • view/components/ui/env-variables-editor.tsx
📚 Learning: 2025-12-27T03:02:43.092Z
Learnt from: CR
Repo: raghavyuva/nixopus PR: 0
File: .cursor/rules/frontend.mdc:0-0
Timestamp: 2025-12-27T03:02:43.092Z
Learning: Applies to view/**/*.{tsx,ts} : Prevent unnecessary re-renders with `useCallback`

Applied to files:

  • view/hooks/use-env-variables-editor.ts
🧬 Code graph analysis (1)
view/components/ui/env-variables-editor.tsx (1)
view/lib/utils.ts (1)
  • cn (4-6)
🔇 Additional comments (6)
view/hooks/use-env-variables-editor.ts (2)

3-3: LGTM: Import addition for useRef.

The addition of useRef to the imports is appropriate for the new initialization guard pattern.


51-68: Add a comment explaining the one-time initialization behavior.

The initialization guard intentionally prevents re-initialization on prop changes, which prevents unwanted resets while users edit variables. However, declaring defaultValues in the dependency array while ignoring subsequent changes is misleading. This pattern needs clarification to avoid surprising future maintainers.

Suggest one of:

  1. Add a JSDoc comment explaining this is intentional one-time initialization
  2. Remove defaultValues from the dependency array and add an inline comment explaining why
  3. Add a comment above the effect: // Initialize once from defaultValues; ignore updates to prevent resetting user edits
view/components/ui/env-variables-editor.tsx (4)

72-72: LGTM: Truncation constant for DRY principle.

The INPUT_TRUNCATE constant effectively centralizes truncation styling and ensures consistent text overflow behavior across all input fields in the editor.


99-109: LGTM: Consistent truncation in edit mode.

The application of INPUT_TRUNCATE to both edit key and value inputs ensures consistent text overflow handling during editing.


361-385: Clarify: "Removal of scrolling" vs. overflow-y-auto.

The PR objectives mention "removal of scrolling to allow vertical flow," but line 361 still includes overflow-y-auto, which enables vertical scrolling. This appears to be a replacement of the ScrollArea component with native CSS scrolling rather than complete removal of scrolling behavior.

Please clarify the intended behavior. If the goal was to:

  1. Remove custom ScrollArea component: The change is correct
  2. Remove all scrolling: Consider removing overflow-y-auto and using a different layout approach
  3. Improve scrolling behavior: Consider documenting what issues the ScrollArea component was causing

Additionally, verify that removing the ScrollArea component doesn't impact:

  • Accessibility features (keyboard navigation, screen reader support)
  • Cross-browser scrolling behavior
  • Custom scrollbar styling

Based on learnings: The learnings mention critical environment variable export issues in Nixopus. While this change doesn't directly affect the export functionality, ensure that the UI changes don't inadvertently prevent users from properly viewing or editing environment variables that are critical for container health checks.


389-412: LGTM: Consistent truncation for new variable inputs.

The new variable input fields properly apply the INPUT_TRUNCATE constant and use the cn() utility for conditional styling. The addition of min-w-0 to the container enables proper text truncation in flex layouts.

@raghavyuva
Copy link
Owner

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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)
view/hooks/use-env-variables-editor.ts (1)

53-68: Simplify logic and add explanatory comment.

The initialization guard works correctly but the else-if block is unnecessarily verbose. Per coding guidelines, prefer early returns and flat structure over nested conditions.

Additionally, add a comment explaining WHY this guard exists (per guidelines: "explain WHY code works a certain way, not WHAT it does"). Based on the PR objectives, this prevents a UI quirk where the form would reset on re-renders.

♻️ Simplified implementation
  useEffect(() => {
-    if (!hasInitialized.current && defaultValues && Object.keys(defaultValues).length > 0) {
+    // Guard prevents re-initialization on re-renders, fixing form reset quirk
+    if (hasInitialized.current) return;
+    
+    if (defaultValues && Object.keys(defaultValues).length > 0) {
      const vars = Object.entries(defaultValues).map(([key, value]) => ({
        key,
        value,
        isSecret: false
      }));
      setVariables(vars);
-      hasInitialized.current = true;
-    } else if (
-      !hasInitialized.current &&
-      (!defaultValues || Object.keys(defaultValues).length === 0)
-    ) {
-      hasInitialized.current = true;
    }
+    hasInitialized.current = true;
  }, [defaultValues]);
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7f00be and b838ff7.

📒 Files selected for processing (2)
  • view/components/ui/env-variables-editor.tsx
  • view/hooks/use-env-variables-editor.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • view/components/ui/env-variables-editor.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

**/*.{ts,tsx}: Before writing any new logic, search the codebase for existing implementations in view/hooks/, view/lib/utils.ts, view/components/ui/, and view/redux/services/ before creating custom elements
Extract repeated patterns into custom hooks or shared components
Use early returns and flat structure instead of nested conditions for improved code readability
Always use typed hooks useAppDispatch and useAppSelector from @/redux/hooks instead of untyped useDispatch and useSelector
Never use any type; always use explicit types for function parameters and return values
Remove unused imports immediately and delete commented-out code
Keep files focused and minimal by removing unused variables and functions
In comments, explain WHY code works a certain way, not WHAT it does
Never disable lint rules without strong justification

Files:

  • view/hooks/use-env-variables-editor.ts
view/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

view/**/*.{tsx,ts}: Each component file should export one main component
Never write plain HTML for interactive elements; always use shadcn components like Button, Card, Badge, Skeleton
Use the cn() utility function for conditional Tailwind classes
No hardcoded user-facing strings; always use i18n with the useTranslation hook
Handle loading states by checking isLoading from RTK Query and returning skeleton loaders or loading components
Handle error states by checking error values from RTK Query and displaying error messages using i18n
Show empty state UI when data is empty using i18n messages
Always provide skeleton loaders for async content instead of blank/white space
Use semantic HTML elements for accessibility
Provide proper ARIA labels where needed for accessibility
Memoize expensive computations with useMemo
Prevent unnecessary re-renders with useCallback
Use React Query's caching effectively to avoid redundant API calls
Lazy load heavy components when appropriate
Ensure responsive design works on all screen sizes

Files:

  • view/hooks/use-env-variables-editor.ts
view/hooks/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

view/hooks/**/*.ts: Use generic patterns for typed hooks to handle type-safe data manipulation
Use JSDoc comments for complex hooks and functions to explain their purpose and parameters

Files:

  • view/hooks/use-env-variables-editor.ts
view/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

view/**/*.{ts,tsx}: Respect ESLint rules configured in view/eslint.config.mjs
Use Prettier for consistent formatting and fix all lint errors before committing

Files:

  • view/hooks/use-env-variables-editor.ts
🧠 Learnings (1)
📚 Learning: 2025-12-27T03:02:43.092Z
Learnt from: CR
Repo: raghavyuva/nixopus PR: 0
File: .cursor/rules/frontend.mdc:0-0
Timestamp: 2025-12-27T03:02:43.092Z
Learning: Applies to view/**/*.{tsx,ts} : Prevent unnecessary re-renders with `useCallback`

Applied to files:

  • view/hooks/use-env-variables-editor.ts
🔇 Additional comments (2)
view/hooks/use-env-variables-editor.ts (2)

3-3: LGTM! useRef import is necessary and properly used.

The import addition is appropriate for the new initialization guard pattern.


51-51: LGTM! Ref declaration follows React best practices.

The hasInitialized ref appropriately tracks initialization state across renders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants