Picking an engine before typing does not blank the page - #577
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
WaylandYang
force-pushed
the
fix/issue-573
branch
from
September 9, 2026 23:07
2e88355 to
dad2865
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #573. Thanks @MatheusCylo — reproduced exactly as reported.
Open Administration → Data sources → Add data source, choose "Connection string"
from the engine list, and the whole page is replaced by "Something went wrong!
Cannot read properties of undefined (reading 'trim')". Nothing has been typed yet;
selecting the option is enough.
Why
The dialog rebuilds the connection string on every render:
valuesholds only the fields somebody has actually typed into, so right afterswitching engines it is
{}. Therawengine's builder was(v) => v.conn.trim(), andv.connisundefined.The type signature is what let it through.
buildwas declared(v: Record<string, string>) => string, and an index signature claims every keyyields a
string, neverundefined. Sov.conn.trim()type-checked. The other fiveengines survived only because they interpolate into template strings, where
undefinedis quietly stringified into"undefined"— the same hole, just silent.The fix
Make the type tell the truth:
buildnow takesPartial<Record<string, string>>,which is what it has always been handed.
Turning that on produced six more errors immediately —
auth(v.user, v.password)inthree engines and
enc(...)in two. Both helpers already handled absent valuescorrectly (
authtests truthiness,encshould encode""); only their signaturessaid otherwise. They now say what they do. That is the whole class of bug, not just
the one reported instance.
Test
dsSpecsis exported anddsSpecs.test.tsasserts, for every engine, thatbuilding from an empty form and from a half-filled form does not throw, plus that the
raw engine trims. Written against all engines rather than the one that broke, so a
future engine added with a naive builder lands in the same net.
Confirmed RED before the fix: the empty-form assertion failed on
raw.Checked
pnpm test18 passed;pnpm buildclean; style guard 46/46.MySQL, Trino, Databricks, Snowflake, Connection string — no errors, dialog stays
open. Before the fix the last one blanked the page.
string field render, and "Test connection" enables.
Not in this change
noUncheckedIndexedAccessintsconfigwould have caught this at compile time andwould catch the next one. It is worth doing and it is not a two-line change, so it
belongs on its own.
🤖 Generated with Claude Code