Skip to content

Commit 44b6544

Browse files
committed
v4.6.1
1 parent af1b218 commit 44b6544

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netdata/netdata-ui",
3-
"version": "4.6.0",
3+
"version": "4.6.1",
44
"description": "netdata UI kit",
55
"main": "dist/index.js",
66
"module": "dist/es6/index.js",

src/components/table/header/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const Header = ({
2020
children,
2121
bulkActions,
2222
enableColumnVisibility,
23+
enableCustomSearch,
2324
}) => {
2425
tableMeta = useMemo(
2526
() => (typeof tableMeta === "function" ? tableMeta({}, {}, null) : tableMeta),
@@ -49,6 +50,7 @@ const Header = ({
4950
iconLeft={<Icon color="textLite" name="magnify" height="18px" width="18px" />}
5051
onChange={onSearch}
5152
placeholder={searchPlaceholder}
53+
controlled={enableCustomSearch}
5254
{...tableMeta.searchStyles}
5355
/>
5456
</Flex>

src/components/table/table.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ const Table = memo(
251251
dataColumns={dataColumns}
252252
enableColumnVisibility={enableColumnVisibility}
253253
bulkActions={bulkActions}
254+
enableCustomSearch={enableCustomSearch}
254255
>
255256
{headerChildren || null}
256257
<HeaderActions

src/organisms/documentation/search/input.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React, { useState, useCallback } from "react"
1+
import React, { useEffect, useState, useCallback } from "react"
22
import useDebounce from "@/hooks/useDebounce"
33
import { TextInput } from "@/components/input"
44
import { Icon } from "@/components/icon"
55

6-
const SearchInput = ({ value: defaultValue, setSearchTerm, setSearchView }) => {
6+
const SearchInput = ({ value: defaultValue, setSearchTerm, setSearchView, controlled }) => {
77
const [value, setValue] = useState(defaultValue)
88

99
useDebounce(
@@ -18,6 +18,12 @@ const SearchInput = ({ value: defaultValue, setSearchTerm, setSearchView }) => {
1818

1919
const onChange = useCallback(e => setValue(e.target.value), [])
2020

21+
useEffect(() => {
22+
if (!controlled) return
23+
24+
setValue(defaultValue)
25+
}, [defaultValue])
26+
2127
return (
2228
<TextInput
2329
value={value}

0 commit comments

Comments
 (0)