Skip to content

Commit 2da175a

Browse files
committed
fix: remove redundant type check and rename
1 parent 9c6bb47 commit 2da175a

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

packages/compass-crud/src/components/document.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,17 @@ const Document = (props: DocumentProps) => {
3030
if (typeof _doc?.isRoot === 'function' && _doc?.isRoot()) {
3131
return _doc as HadronDocument;
3232
}
33-
return new HadronDocument(_doc as any);
33+
return new HadronDocument(_doc as unknown);
3434
}, [_doc]);
3535

3636
const changeQuery = useChangeQueryBarQuery();
3737

38-
const onAddToQuery = useCallback(
39-
(field: string, value: any) => {
40-
if (changeQuery) {
41-
changeQuery('setValue', {
42-
field,
43-
value,
44-
});
45-
}
38+
const handleAddToQuery = useCallback(
39+
(field: string, value: unknown) => {
40+
changeQuery('setValue', {
41+
field,
42+
value,
43+
});
4644
},
4745
[changeQuery]
4846
);
@@ -55,22 +53,22 @@ const Document = (props: DocumentProps) => {
5553
openInsertDocumentDialog={(doc, cloned) => {
5654
void openInsertDocumentDialog?.(doc, cloned);
5755
}}
58-
onAddToQuery={onAddToQuery}
56+
onAddToQuery={handleAddToQuery}
5957
/>
6058
);
6159
}
6260

6361
if (editable) {
6462
return (
65-
<EditableDocument {...props} doc={doc} onAddToQuery={onAddToQuery} />
63+
<EditableDocument {...props} doc={doc} onAddToQuery={handleAddToQuery} />
6664
);
6765
}
6866

6967
return (
7068
<ReadonlyDocument
7169
doc={doc}
7270
copyToClipboard={copyToClipboard}
73-
onAddToQuery={onAddToQuery}
71+
onAddToQuery={handleAddToQuery}
7472
/>
7573
);
7674
};

0 commit comments

Comments
 (0)