Skip to content

Commit

Permalink
Merge pull request #413 from webitel/fix/reset-selected-items-in-table
Browse files Browse the repository at this point in the history
fix: reset selected items in table[WTEL-4740](https://webitel.atlassi…
  • Loading branch information
dlohvinov authored Jan 9, 2025
2 parents ec3b9c7 + dfe80e4 commit 119d23e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webitel/ui-sdk",
"version": "24.12.46",
"version": "24.12.47",
"private": false,
"scripts": {
"dev": "vite",
Expand Down
13 changes: 2 additions & 11 deletions src/store/new/modules/tableStoreModule/tableStoreModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ const actions = {

context.commit('SET', { path: 'dataList', value: items });
context.commit('SET', { path: 'isNextPage', value: next });
context.commit('SET', { path: 'selected', value: [] });
} catch (err) {
context.commit('SET', { path: 'error', value: err });
throw err;
} finally {

setTimeout(() => {
context.commit('SET', { path: 'isLoading', value: false });
}, 100); // why 1s? https://ux.stackexchange.com/a/104782
Expand Down Expand Up @@ -240,21 +242,10 @@ const actions = {
context.dispatch('api/PATCH_ITEM', payload),
DELETE_ITEM_API: (context, payload) =>
context.dispatch('api/DELETE_ITEM', payload),

RESET_TABLE_STATE: async (context) => {
context.commit('RESET_TABLE_STATE');
},
};

const mutations = {
RESET_TABLE_STATE: (state) => {
Object.assign(state, deepCopy(state._resettable));
},
};

export default () => ({
state: state(),
getters,
actions,
mutations,
});
5 changes: 0 additions & 5 deletions src/store/new/modules/tableStoreModule/useTableStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ export const useTableStore = (namespace) => {
return store.dispatch(`${tableNamespace}/SET_SELECTED`, payload);
}

function resetState(payload) {
return store.dispatch(`${tableNamespace}/RESET_TABLE_STATE`, payload);
}

return {
namespace: tableNamespace,

Expand All @@ -78,6 +74,5 @@ export const useTableStore = (namespace) => {
deleteData,
sort,
setSelected,
resetState,
};
};

0 comments on commit 119d23e

Please sign in to comment.