feat: Vite + vue 3 💚 (#10047)
Fixes https://github.com/chatwoot/chatwoot/issues/8436 Fixes https://github.com/chatwoot/chatwoot/issues/9767 Fixes https://github.com/chatwoot/chatwoot/issues/10156 Fixes https://github.com/chatwoot/chatwoot/issues/6031 Fixes https://github.com/chatwoot/chatwoot/issues/5696 Fixes https://github.com/chatwoot/chatwoot/issues/9250 Fixes https://github.com/chatwoot/chatwoot/issues/9762 --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import types from '../../mutation-types';
|
||||
import Vue from 'vue';
|
||||
|
||||
export const mutations = {
|
||||
[types.SET_UI_FLAG](_state, uiFlags) {
|
||||
@@ -12,14 +11,12 @@ export const mutations = {
|
||||
[types.ADD_ARTICLE]: ($state, article) => {
|
||||
if (!article.id) return;
|
||||
|
||||
Vue.set($state.articles.byId, article.id, {
|
||||
...article,
|
||||
});
|
||||
$state.articles.byId[article.id] = article;
|
||||
},
|
||||
[types.CLEAR_ARTICLES]: $state => {
|
||||
Vue.set($state.articles, 'byId', {});
|
||||
Vue.set($state.articles, 'allIds', []);
|
||||
Vue.set($state.articles, 'uiFlags.byId', {});
|
||||
$state.articles.allIds = [];
|
||||
$state.articles.byId = {};
|
||||
$state.articles.uiFlags.byId = {};
|
||||
},
|
||||
[types.ADD_MANY_ARTICLES]($state, articles) {
|
||||
const allArticles = { ...$state.articles.byId };
|
||||
@@ -27,7 +24,7 @@ export const mutations = {
|
||||
allArticles[article.id] = article;
|
||||
});
|
||||
|
||||
Vue.set($state.articles, 'byId', allArticles);
|
||||
$state.articles.byId = allArticles;
|
||||
},
|
||||
[types.ADD_MANY_ARTICLES_ID]($state, articleIds) {
|
||||
$state.articles.allIds.push(...articleIds);
|
||||
@@ -35,8 +32,8 @@ export const mutations = {
|
||||
|
||||
[types.SET_ARTICLES_META]: ($state, data) => {
|
||||
const { articles_count: count, current_page: currentPage } = data;
|
||||
Vue.set($state.meta, 'count', count);
|
||||
Vue.set($state.meta, 'currentPage', currentPage);
|
||||
$state.meta.count = count;
|
||||
$state.meta.currentPage = currentPage;
|
||||
},
|
||||
|
||||
[types.ADD_ARTICLE_ID]: ($state, articleId) => {
|
||||
@@ -47,7 +44,7 @@ export const mutations = {
|
||||
const flags =
|
||||
Object.keys($state.articles.uiFlags.byId).includes(articleId) || {};
|
||||
|
||||
Vue.set($state.articles.uiFlags.byId, articleId, {
|
||||
$state.articles.uiFlags.byId[articleId] = {
|
||||
...{
|
||||
isFetching: false,
|
||||
isUpdating: false,
|
||||
@@ -55,29 +52,27 @@ export const mutations = {
|
||||
},
|
||||
...flags,
|
||||
...uiFlags,
|
||||
});
|
||||
};
|
||||
},
|
||||
[types.ADD_ARTICLE_FLAG]: ($state, { articleId, uiFlags }) => {
|
||||
Vue.set($state.articles.uiFlags.byId, articleId, {
|
||||
$state.articles.uiFlags.byId[articleId] = {
|
||||
...{
|
||||
isFetching: false,
|
||||
isUpdating: false,
|
||||
isDeleting: false,
|
||||
},
|
||||
...uiFlags,
|
||||
});
|
||||
};
|
||||
},
|
||||
[types.UPDATE_ARTICLE]($state, article) {
|
||||
const articleId = article.id;
|
||||
if (!$state.articles.allIds.includes(articleId)) return;
|
||||
|
||||
Vue.set($state.articles.byId, articleId, {
|
||||
...article,
|
||||
});
|
||||
$state.articles.byId[articleId] = { ...article };
|
||||
},
|
||||
[types.REMOVE_ARTICLE]($state, articleId) {
|
||||
const { [articleId]: toBeRemoved, ...newById } = $state.articles.byId;
|
||||
Vue.set($state.articles, 'byId', newById);
|
||||
$state.articles.byId = newById;
|
||||
},
|
||||
[types.REMOVE_ARTICLE_ID]($state, articleId) {
|
||||
$state.articles.allIds = $state.articles.allIds.filter(
|
||||
|
||||
Reference in New Issue
Block a user