Skip to content

Commit b260ae9

Browse files
committed
[tools] Missing useRowCount
1 parent 86f55a3 commit b260ae9

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/tools/api/core.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from '../../common/strings';
2222
import {
2323
CALLBACK,
24+
COUNT,
2425
DO_ACTIONS_AND_ROLLBACK_PARAMS,
2526
DO_ROLLBACK_PARAM,
2627
EXPORT,
@@ -523,7 +524,7 @@ export const getStoreCoreApi = (
523524
addProxyMethod(
524525
0,
525526
tableName,
526-
ROW + 'Count',
527+
ROW + COUNT,
527528
'number',
528529
'Gets the number of Rows in the ' + getTableDoc(tableId),
529530
EMPTY_STRING,
@@ -718,7 +719,7 @@ export const getStoreCoreApi = (
718719

719720
// addRowCountListener
720721
addProxyListener(
721-
ROW + 'Count',
722+
ROW + COUNT,
722723
rowCountListenerType,
723724
getListenerDoc(15, 3),
724725
`tableId: ${tableIdType} | null`,

src/tools/api/react.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
A,
33
AND_REGISTERS,
44
CALLBACK,
5+
COUNT,
56
DEL,
67
DEPS,
78
DEPS_SUFFIX,
@@ -37,6 +38,7 @@ import {
3738
GET,
3839
IDS,
3940
LISTENER,
41+
NUMBER,
4042
ROW,
4143
ROW_IDS,
4244
SORTED_ROW_IDS,
@@ -666,6 +668,16 @@ export const getStoreUiReactApi = (
666668
TABLE_ID,
667669
);
668670

671+
// useRowCount
672+
addProxyHook(
673+
tableName + ROW + COUNT,
674+
ROW + COUNT,
675+
NUMBER,
676+
'Gets the number of Rows in ' + getTableDoc(tableId) + AND_REGISTERS,
677+
EMPTY_STRING,
678+
TABLE_ID,
679+
);
680+
669681
// useRowIds
670682
const useRowIds = addProxyHook(
671683
tableName + ROW_IDS,

src/tools/common/strings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const AND_REGISTERS =
2323
', and registers a listener so that any changes to ' +
2424
'that result will cause a re-render';
2525
export const CALLBACK = 'Callback';
26+
export const COUNT = 'Count';
2627
export const DEL = 'Del';
2728
export const DEPS = 'Deps';
2829
export const DEPS_SUFFIX = DEPS + '?: React.DependencyList';

0 commit comments

Comments
 (0)