Skip to content

fix: preserve pgpass setting when loading existing connections#366

Merged
datlechin merged 1 commit intomainfrom
fix/pgpass-persistence
Mar 18, 2026
Merged

fix: preserve pgpass setting when loading existing connections#366
datlechin merged 1 commit intomainfrom
fix/pgpass-persistence

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

@datlechin datlechin commented Mar 18, 2026

Summary

  • Fixed onChange(of: type) unconditionally resetting additionalFieldValues during initial load, which wiped the persisted usePgpass setting when editing an existing PostgreSQL connection
  • Moved the reset inside the hasLoadedData guard so it only runs when the user manually changes the database type, not during initial form population

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where connection form fields would not properly reinitialize when changing connection types, ensuring all settings are correctly updated for the newly selected type.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: beb030d0-0770-4632-a89c-25f58bb40f11

📥 Commits

Reviewing files that changed from the base of the PR and between ddcd83c and adcded8.

📒 Files selected for processing (1)
  • TablePro/Views/Connection/ConnectionFormView.swift

📝 Walkthrough

Walkthrough

The connection type switching logic in ConnectionFormView is refactored to reinitialize additional connection fields and port within the hasLoadedData block when the user changes connection types after data has loaded, ensuring proper initialization order.

Changes

Cohort / File(s) Summary
Connection Field Reinitialization
TablePro/Views/Connection/ConnectionFormView.swift
Modified connection type change handler to clear and repopulate additionalFieldValues with defaults from PluginManager and reset port to the new type's defaultPort, moving this logic into the hasLoadedData block for proper initialization timing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 When types do shift and data flows,
We reinitialize—now no one knows,
A careful reset, defaults align,
Connection fields at last combine! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pgpass-persistence
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@datlechin datlechin merged commit 9dae5ba into main Mar 18, 2026
2 of 3 checks passed
@datlechin datlechin deleted the fix/pgpass-persistence branch March 18, 2026 08:56
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.

1 participant