Skip to content

Commit eb86b4a

Browse files
wilfred-asomaniiStorj Robot
authored andcommitted
satellite/admin-ui: fix user/project state update bug
This change fixes a bug where after a user/project is update from a dialog, the user/project detail page will vanish and appear again with the dialog still open. This happens because when the new state is being fetched after the update, the current state is set to null. This change removes the clearing of current user/project state before fetching the new state. Change-Id: Ia0ea99c00b2a01305f7ed64322fc44ddb513da95
1 parent fe89fd4 commit eb86b4a

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

satellite/admin/back-office/ui/src/components/GlobalSearchDialog.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
</template>
150150

151151
<script setup lang="ts">
152-
import { computed, onMounted, ref } from 'vue';
152+
import { computed, ref } from 'vue';
153153
import { useRouter } from 'vue-router';
154154
import { VBtn, VCard, VChip, VContainer, VDataTable, VDialog, VIcon, VTextField } from 'vuetify/components';
155155
import { Box, Search, User, X } from 'lucide-vue-next';
@@ -159,12 +159,10 @@ import { AccountMin, Project, SearchResult, UserStatusInfo } from '@/api/client.
159159
import { useAppStore } from '@/store/app';
160160
import { useNotificationsStore } from '@/store/notifications';
161161
import { ROUTES } from '@/router';
162-
import { useUsersStore } from '@/store/users';
163162
import { userIsNFR, userIsPaid } from '@/types/user';
164163
import { useLoading } from '@/composables/useLoading';
165164
166165
const appStore = useAppStore();
167-
const usersStore = useUsersStore();
168166
const notify = useNotificationsStore();
169167
const router = useRouter();
170168
const { isLoading } = useLoading();
@@ -248,10 +246,6 @@ function goToProject(project: Project):void {
248246
router.push({ name: ROUTES.AccountProject.name, params: { projectID: project.id, userID: project.owner.id } });
249247
model.value = false;
250248
}
251-
252-
onMounted(() => {
253-
usersStore.clearCurrentUser();
254-
});
255249
</script>
256250
<style scoped lang="scss">
257251
:deep(.v-data-table-footer) {

satellite/admin/back-office/ui/src/store/projects.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const useProjectsStore = defineStore('projects', () => {
2626

2727
async function updateCurrentProject(project: string | Project): Promise<void> {
2828
if (typeof project === 'string') {
29-
clearCurrentProject();
3029
state.currentProject = await getProject(project);
3130
return;
3231
}

satellite/admin/back-office/ui/src/store/users.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const useUsersStore = defineStore('users', () => {
4343
// Update the current user stored in the state.
4444
async function updateCurrentUser(user: string | UserAccount): Promise<void> {
4545
if (typeof user === 'string') {
46-
clearCurrentUser();
4746
state.currentAccount = await getUser(user);
4847
return;
4948
}

satellite/admin/back-office/ui/src/views/AccountDetails.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
</template>
220220

221221
<script setup lang="ts">
222-
import { computed, ref, watch } from 'vue';
222+
import { computed, onUnmounted, ref, watch } from 'vue';
223223
import { useRouter } from 'vue-router';
224224
import {
225225
VAlert,
@@ -389,4 +389,6 @@ watch(() => router.currentRoute.value.params.userID as string, (userID) => {
389389
}
390390
});
391391
}, { immediate: true });
392+
393+
onUnmounted(() => usersStore.clearCurrentUser());
392394
</script>

0 commit comments

Comments
 (0)