Skip to content

Commit b1a220e

Browse files
authored
Merge pull request #168 from ownego/fix/index-table-losing-reactive
Fix: IndexTable lost its reactive context properties
2 parents f1a27ef + 22f75af commit b1a220e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/components/IndexProvider/IndexProvider.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ provide<IndexContextType>('IndexContext', {
153153
bulkActionsAccessibilityLabel,
154154
selectMode: selectModeRef,
155155
paginatedSelectAllText,
156-
itemCount: props.itemCount,
156+
itemCount: toRef(props, 'itemCount'),
157157
selectable: toRef(props, 'selectable'),
158-
hasMoreItems: props.hasMoreItems,
158+
hasMoreItems: toRef(props, 'hasMoreItems'),
159159
condensed: toRef(props, 'condensed'),
160160
bulkActionsLabel,
161161
});

src/components/IndexTable/IndexTableBase.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ const bulkActionsSelectable = computed(() => Boolean(
629629
630630
const selectedItemsCountLabel = computed(() =>
631631
selectedItemsCount.value === SELECT_ALL_ITEMS
632-
? `${itemCount}+`
632+
? `${itemCount.value}+`
633633
: selectedItemsCount.value,
634634
);
635635
@@ -691,14 +691,14 @@ const bulkActionLabel = computed(() => {
691691
});
692692
693693
const paginatedSelectAllAction = computed(() => {
694-
if (!selectable?.value || !hasBulkActions.value || !hasMoreItems) {
694+
if (!selectable?.value || !hasBulkActions.value || !hasMoreItems?.value) {
695695
return;
696696
}
697697
698698
const customActionText =
699699
props.paginatedSelectAllActionText ??
700700
i18n.translate('Polaris.IndexTable.selectAllItems', {
701-
itemsLength: itemCount,
701+
itemsLength: itemCount.value,
702702
resourceNamePlural: resourceName.plural.toLocaleLowerCase(),
703703
});
704704

src/utilities/index-provider/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export interface IndexContextType {
1212
bulkActionsLabel: ComputedRef<string>;
1313
selectMode: ComputedRef<boolean>;
1414
paginatedSelectAllText?: ComputedRef<string | undefined>;
15-
itemCount: number;
15+
itemCount: Ref<number>;
1616
selectable?: Ref<boolean>;
17-
hasMoreItems?: boolean;
17+
hasMoreItems?: Ref<boolean | undefined>;
1818
condensed?: Ref<boolean | undefined>;
1919
}
2020

0 commit comments

Comments
 (0)