Skip to content

Commit 86fa929

Browse files
authored
refactor: remove duplicate Connection type definition (#935)
Ref: HDX-1905
1 parent d1f4184 commit 86fa929

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

.changeset/tender-mails-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
Removed duplicate type definition.

packages/app/src/components/ConnectionForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useCallback, useEffect, useState } from 'react';
22
import { useForm } from 'react-hook-form';
33
import { testLocalConnection } from '@hyperdx/common-utils/dist/clickhouse';
4+
import { Connection } from '@hyperdx/common-utils/dist/types';
45
import { Box, Button, Flex, Group, Stack, Text, Tooltip } from '@mantine/core';
56
import { notifications } from '@mantine/notifications';
67

@@ -11,7 +12,6 @@ import {
1112
} from '@/components/InputControlled';
1213
import { IS_LOCAL_MODE } from '@/config';
1314
import {
14-
Connection,
1515
useCreateConnection,
1616
useDeleteConnection,
1717
useUpdateConnection,

packages/app/src/components/__tests__/ConnectionForm.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
2+
import { Connection } from '@hyperdx/common-utils/dist/types';
23
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
34

4-
import { Connection } from '../../connection';
55
import { ConnectionForm } from '../ConnectionForm';
66

77
import '@testing-library/jest-dom';

packages/app/src/connection.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import store from 'store2';
22
import { testLocalConnection } from '@hyperdx/common-utils/dist/clickhouse';
3+
import { Connection } from '@hyperdx/common-utils/dist/types';
34
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
45

56
import { hdxServer } from '@/api';
@@ -8,14 +9,6 @@ import { parseJSON } from '@/utils';
89

910
export const LOCAL_STORE_CONNECTIONS_KEY = 'connections';
1011

11-
export type Connection = {
12-
id: string;
13-
name: string;
14-
host: string;
15-
username: string;
16-
password: string;
17-
};
18-
1912
function setLocalConnections(newConnections: Connection[]) {
2013
// sessing sessionStorage doesn't send a storage event to the open tab, only
2114
// another tab. Let's send one anyways for any listeners in other components
@@ -69,7 +62,7 @@ export function useCreateConnection() {
6962
const isValid = await testLocalConnection({
7063
host: connection.host,
7164
username: connection.username,
72-
password: connection.password,
65+
password: connection.password ?? '',
7366
});
7467

7568
if (!isValid) {

0 commit comments

Comments
 (0)