Skip to content

Commit 76453de

Browse files
authored
fix: harden clickhouse embedded (#1927)
## Summary ClickStack embedded seemed to sometimes show `http://localhost:8123` instead of `window.location.origin` in the onboarding connection form. These changes should harden the behavior to show `window.location.origin`
1 parent 5db445b commit 76453de

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎packages/app/src/TeamPage.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
import { ConnectionForm } from '@/components/ConnectionForm';
3434
import SelectControlled from '@/components/SelectControlled';
3535
import { SourcesList } from '@/components/Sources/SourcesList';
36-
import { IS_LOCAL_MODE } from '@/config';
36+
import { IS_CLICKHOUSE_BUILD, IS_LOCAL_MODE } from '@/config';
3737

3838
import { PageHeader } from './components/PageHeader';
3939
import TeamMembersSection from './components/TeamSettings/TeamMembersSection';
@@ -125,7 +125,9 @@ function ConnectionsSection() {
125125
connection={{
126126
id: 'new',
127127
name: 'My New Connection',
128-
host: 'http://localhost:8123',
128+
host: IS_CLICKHOUSE_BUILD
129+
? window.location.origin
130+
: 'http://localhost:8123',
129131
username: 'default',
130132
password: '',
131133
}}

‎packages/app/src/components/ConnectionForm.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
InputControlled,
2121
PasswordInputControlled,
2222
} from '@/components/InputControlled';
23-
import { IS_LOCAL_MODE } from '@/config';
23+
import { IS_CLICKHOUSE_BUILD, IS_LOCAL_MODE } from '@/config';
2424
import {
2525
useCreateConnection,
2626
useDeleteConnection,
@@ -243,7 +243,11 @@ export function ConnectionForm({
243243
data-testid="connection-host-input"
244244
name="host"
245245
control={control}
246-
placeholder="http://localhost:8123"
246+
placeholder={
247+
IS_CLICKHOUSE_BUILD
248+
? window.location.origin
249+
: 'http://localhost:8123'
250+
}
247251
rules={{ required: 'Host is required' }}
248252
/>
249253
</Box>

0 commit comments

Comments
 (0)