Skip to content

Commit 97fe831

Browse files
committed
sortData: use full data if search is empty
1 parent 3d27531 commit 97fe831

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/table/QwikTable.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const QwikTable = component$((props) => {
5555
sortOrder: sortOrder,
5656
totalPosts: totalPosts,
5757
prevSearch: prevSearch,
58+
searchInp: searchInp,
5859
searchBy: searchBy
5960
}))
6061

src/utils/sortData.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export function sortData({
77
sortOrder,
88
totalPosts,
99
prevSearch,
10+
searchInp,
1011
searchBy
1112
}
1213

@@ -23,7 +24,7 @@ export function sortData({
2324
) {
2425
const initialSearchKey = searchBy.value;
2526

26-
if (tableData.length === 0) tableData = data;
27+
if (tableData.length === 0 || searchInp.value === '') tableData = data;
2728

2829
totalPosts.value = tableData.length;
2930

0 commit comments

Comments
 (0)