Skip to content

Commit

Permalink
fix(ktable): emit preferences only in success state [KHCP-11890] (#2191)
Browse files Browse the repository at this point in the history
* fix(ktable): emit preferences only in success state [KHCP-11890]

* docs(table): add note about table preferences event [KHCP-11890]

* docs(table): minor fix [KHCP-11890]
  • Loading branch information
portikM authored and adamdehaven committed Jun 15, 2024
1 parent c7ae93f commit 10ff5ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/components/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,10 @@ Emitted when error state action button is clicked.
Fired when the user changes the table's page size, performs sorting, resizes columns or toggles column visibility. Event payload is object of type `TablePreferences` interface (see [`tablePreferences` prop](#tablepreferences) for details).
:::warning WARNING
`update:table-preferences` event only fires when KTable is in `success` state (see [`state` event](#state) for details).
:::
<script setup lang="ts">
import { AddIcon, SearchIcon, MoreIcon } from '@kong/icons'
import { getCurrentInstance } from 'vue'
Expand Down
4 changes: 3 additions & 1 deletion src/components/KTable/KTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,9 @@ const tablePreferences = computed((): TablePreferences => ({
}))
const emitTablePreferences = (): void => {
emit('update:table-preferences', tablePreferences.value)
if (tableState.value === 'success') {
emit('update:table-preferences', tablePreferences.value)
}
}
const getNextOffsetHandler = (): void => {
Expand Down

0 comments on commit 10ff5ae

Please sign in to comment.