Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/application/services/useNoteSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export default function (): UseNoteSettingsComposableState {
* @param id - Note id
*/
const load = async (id: NoteId): Promise<void> => {
noteSettings.value = null;
parentNote.value = undefined;

noteSettings.value = await noteSettingsService.getNoteSettingsById(id);
const response = await noteService.getNoteById(id);

Expand Down
12 changes: 7 additions & 5 deletions src/presentation/pages/NoteSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import useNoteSettings from '@/application/services/useNoteSettings';
import useNote from '@/application/services/useNote';
import { useHead } from 'unhead';
import { useI18n } from 'vue-i18n';
import { computed, ref, onMounted, watch } from 'vue';
import { computed, ref, watch } from 'vue';
import { useDebounceFn } from '@vueuse/core';
import Team from '@/presentation/components/team/Team.vue';
import { Section, Row, Switch, Button, Heading, Fieldset, Input, Card, PageBlock } from '@codexteam/ui/vue';
Expand All @@ -127,7 +127,7 @@ const { patchOpenedPageByUrl } = useNavbar();
const route = useRoute();
const { noteSettings, load: loadSettings, updateIsPublic, deleteNoteById, parentNote, setParent } = useNoteSettings();
const { noteTitle, unlinkParent } = useNote({
id: props.id,
id: () => props.id,
});

/**
Expand Down Expand Up @@ -218,10 +218,12 @@ watch(noteTitle, (newTitle) => {
patchOpenedPageByUrl(route.path, openPageInfo);
});

onMounted(async () => {
await loadSettings(props.id);
watch(() => props.id, async (id) => {
parentURL.value = '';
await loadSettings(id);

parentURL.value = getParentURL(parentNote.value?.id);
});
}, { immediate: true });

/**
* Handle team member removal by refreshing the note settings and removing the member from the team
Expand Down
Loading