fix: Refresh metadata after creating new connection in local mode#1582
fix: Refresh metadata after creating new connection in local mode#1582
Conversation
🦋 Changeset detectedLatest commit: 9ebdc62 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review: Refresh metadata after creating new connection in local mode✅ Overall Assessment: No critical issues found. The implementation correctly addresses the bug where metadata queries fail in local mode due to stale unauthenticated ClickHouse clients. Minor ObservationsPotential consideration (not blocking):
Pattern consistency:
Implementation quality:
Code quality:
Recommendation: Approve and merge. The global query reset is acceptable for local mode's connection-change scenario. |
E2E Test Results✅ All tests passed • 60 passed • 4 skipped • 756s
Tests ran across 4 shards in parallel. |
8c92f37 to
24061b3
Compare
24061b3 to
e6a2db3
Compare
wrn14897
left a comment
There was a problem hiding this comment.
LGTM. I'd suggest doing a bit more testing with the preview before merging
Closes HDX-3177
Summary
This PR fixes a bug in local mode (used, for example, in the play environment) that caused metadata queries to fail due to lack of authentication details (eg. username) in the request parameters.
The cause was that metadata instances are created prior to the creation of the demo connection, which creates the metadata with an un-authenticated ClickHouse client. Those metadata instances (and their ClickHouse clients) were then never updated once the connection was created, resulting in continued failures to load metadata, even after creating the connection.
This PR adds an event listener to the useMetadataWithSettings hook which is triggered when the local connection data is updated. This matches a similar listener created on the search page. The event handler (a) recreates the metadata with a new (auth'd) ClickHouse client and (b) clears the react query cache so that any cached requests that previously errored are refetched.
Notes for Claude:
Before
Note the continued errors in metadata queries after creating the demo connection
Screen.Recording.2026-01-09.at.10.08.42.AM.mov
After
Note the errors stop and the filters / other data loads without issue after creating the demo connection
Screen.Recording.2026-01-09.at.10.18.04.AM.mov