Skip to content

Commit

Permalink
Why is this needed?
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Oct 30, 2024
1 parent 981febc commit fe3f072
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/components/PageDisplay/PageDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default {
setup() {
const { config, isConfigLoaded } = useConfig(true);
const userStore = useUserStore();
const { currentUser } = storeToRefs(userStore);
return { config, currentUser, isConfigLoaded };
const { currentUser, isCurrentUserLoaded } = storeToRefs(userStore);
return { config, currentUser, isConfigLoaded, isCurrentUserLoaded };
},
data() {
return {
Expand All @@ -56,7 +56,7 @@ export default {
},
computed: {
userOwnsPage() {
return this.currentUser.username === this.page.username;
return this.isCurrentUserLoaded && this.currentUser.username === this.page.username;
},
dataUrl() {
return `/api/pages/${this.pageId}`;
Expand Down
2 changes: 2 additions & 0 deletions client/src/stores/userStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ListViewMode = "grid" | "list";

export const useUserStore = defineStore("userStore", () => {
const currentUser = ref<AnyUser>(null);
const isCurrentUserLoaded = computed(() => !!currentUser.value);
const currentPreferences = ref<Preferences | null>(null);

// explicitly pass current User, because userStore might not exist yet
Expand Down Expand Up @@ -151,6 +152,7 @@ export const useUserStore = defineStore("userStore", () => {
currentPreferences,
isAdmin,
isAnonymous,
isCurrentUserLoaded,
currentTheme,
currentFavorites,
toggledSideBar,
Expand Down

0 comments on commit fe3f072

Please sign in to comment.