Skip to content

Commit 64f3b7a

Browse files
committed
fix(ktabledata): loading prop should override internal loading state
1 parent 065db22 commit 64f3b7a

File tree

4 files changed

+42
-23
lines changed

4 files changed

+42
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"commitizen": "^4.3.1",
102102
"copyfiles": "^2.4.1",
103103
"cross-env": "^7.0.3",
104-
"cypress": "^13.15.2",
104+
"cypress": "^13.17.0",
105105
"cypress-fail-fast": "^7.1.1",
106106
"cz-conventional-changelog": "3.3.0",
107107
"eslint": "^9.19.0",

pnpm-lock.yaml

Lines changed: 19 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/KTableData/KTableData.cy.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,26 @@ describe('KTableData', () => {
189189
cy.get('.skeleton-table-wrapper').should('be.visible')
190190
cy.get('.k-empty-state').should('not.exist')
191191
})
192+
193+
it('does not display a loading state when `loading` is false, regardless of fetcher state', () => {
194+
const slowFetcher = () => {
195+
return new Promise((resolve) => setTimeout(resolve, 2500))
196+
}
197+
198+
cy.mount(KTableData, {
199+
props: {
200+
fetcher: slowFetcher,
201+
headers: options.headers,
202+
cacheIdentifier: 'loading-test',
203+
loading: false,
204+
paginationAttributes: {
205+
pageSizes: [10, 20, 30, 40],
206+
},
207+
},
208+
})
209+
210+
cy.get('.skeleton-table-wrapper').should('not.exist')
211+
})
192212
})
193213

194214
describe('default', () => {

src/components/KTableData/KTableData.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:hide-pagination="hidePagination || !showPagination"
2020
:hide-pagination-when-optional="false"
2121
:hide-toolbar="hideToolbar"
22-
:loading="loading || fetcherIsLoading"
22+
:loading="loading ?? fetcherIsLoading"
2323
:max-height="maxHeight"
2424
:nested="nested"
2525
:pagination-attributes="tablePaginationAttributes"
@@ -188,7 +188,7 @@ const props = withDefaults(defineProps<TableDataProps>(), {
188188
rowBulkActionEnabled: () => true,
189189
rowKey: '',
190190
cellAttrs: () => ({}),
191-
loading: false,
191+
loading: undefined,
192192
emptyStateTitle: 'No Data',
193193
emptyStateMessage: 'There is no data to display.',
194194
emptyStateActionMessage: '',

0 commit comments

Comments
 (0)