Skip to content

Commit

Permalink
Fix: [BUG] Browse location modal doesn't init with current location
Browse files Browse the repository at this point in the history
Close #255
  • Loading branch information
bkis committed Jun 17, 2024
1 parent 5d27ab4 commit aec995c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Tekst-Web/src/components/browse/BrowseLocationControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ whenever(ArrowLeft, () => {

<location-select-modal
v-model:show="showLocationSelectModal"
:initial-location-path="browse.locationPath"
:current-location-path="browse.locationPath"
@submit="handleLocationSelect"
/>
</template>
Expand Down
14 changes: 11 additions & 3 deletions Tekst-Web/src/components/modals/LocationSelectModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ import IconHeading from '@/components/generic/IconHeading.vue';
import LocationSelectForm from '@/forms/LocationSelectForm.vue';
import { BookIcon } from '@/icons';
import { watch } from 'vue';
const props = withDefaults(
defineProps<{
initialLocationPath: LocationRead[];
currentLocationPath: LocationRead[];
showLevelSelect?: boolean;
}>(),
{
showLevelSelect: true,
}
);
const emit = defineEmits(['submit']);
const show = defineModel<boolean>('show');
const emit = defineEmits(['submit']);
const locationPath = ref<LocationRead[]>(props.currentLocationPath);
const locationPath = ref<LocationRead[]>(props.initialLocationPath);
watch(
() => props.currentLocationPath,
(newLocationPath) => {
locationPath.value = newLocationPath;
}
);
function submit() {
emit('submit', locationPath.value);
Expand Down
2 changes: 1 addition & 1 deletion Tekst-Web/src/views/ContentsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ async function handleNearestChangeClick(mode: 'preceding' | 'subsequent') {
<location-select-modal
v-if="resource && locationPath"
v-model:show="showJumpToModal"
:initial-location-path="locationPath"
:current-location-path="locationPath"
:show-level-select="false"
@submit="handleJumpToSubmit"
/>
Expand Down

0 comments on commit aec995c

Please sign in to comment.