Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<bug>(ILM-5898): load current bookid #1459

Merged
merged 1 commit into from
May 23, 2023
Merged
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
1 change: 0 additions & 1 deletion src/components/books/BookMetaEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@
</vue-tab>
<vue-tab title="TOC" id="book-toc">
<BookToc ref="bookToc"
:bookId="currentBook.bookid"
></BookToc>
</vue-tab>
<vue-tab title="Audio" id="audio-integration" :disabled="!tc_displayAudiointegrationTab()">
Expand Down
25 changes: 10 additions & 15 deletions src/components/books/BookToc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ export default {

data () {
return {
currBookId: this.bookId,
loading: false,
sectionsMode: false,
tocSectionCombined: [],
editingSectionId: null,
Expand Down Expand Up @@ -281,7 +279,7 @@ export default {
},

props: [
'bookId',
/*'bookId',*/
],

components: {
Expand Down Expand Up @@ -343,22 +341,15 @@ export default {
//}
},
loadBookTocProxy(isWait = false) {
//if (!isWait) this.freeze('loadBookToc');
if (this.loading) {
return false;
}
this.loading = true;
this.clearErrors();
this.sectionEditMode(null);
this.loadBookTocSections([]);
this.loadBookToc({bookId: this.currBookId, isWait: isWait})
this.loadBookToc({bookId: this.currentBookid, isWait: isWait})
.then((res)=>{
this.loading = false;
this.unfreeze('loadBookToc');

})
.catch((err)=>{
this.loading = false;
this.unfreeze('loadBookToc');

});
},

Expand Down Expand Up @@ -942,13 +933,13 @@ export default {
watch: {
'$route' () {
//console.log('$route', this.currBookId, this.$route.params.bookid);
if (this.$route.params.hasOwnProperty('bookid')) {
/*if (this.$route.params.hasOwnProperty('bookid')) {
if (this.currBookId !== this.$route.params.bookid) {
this.currBookId = this.$route.params.bookid;
this.loadBookTocProxy();
this.loadBookTocSections([this.currBookId]);
}
}
}*/
},
'currentBookid': {
handler() {
Expand All @@ -964,6 +955,10 @@ export default {
titleEn: false,
toc: true
};
if (this.currentBookid) {
this.loadBookTocProxy();
this.loadBookTocSections([]);
}
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2061,10 +2061,8 @@ export const store = new Vuex.Store({
if (state.currentBookToc.bookId === params.bookId && !params.isWait) return state.currentBookToc;
if (state.blockers.indexOf('loadBookToc') !== -1 && state.currentBookToc.bookId !== params.bookId) {
dispatch('unfreeze', 'loadBookToc');
console.log('toc unfreeze');
}
if (state.blockers.indexOf('loadBookToc') !== -1) {
console.log('toc skip');
return state.currentBookToc;
}
dispatch('freeze', 'loadBookToc');
Expand All @@ -2073,8 +2071,8 @@ export const store = new Vuex.Store({
if (params.bookId === state.currentBookid) {
state.currentBookToc.bookId = params.bookId;
state.currentBookToc.data = response.data;
dispatch('unfreeze', 'loadBookToc');
}
dispatch('unfreeze', 'loadBookToc');
return response;
})
.catch(err => {
Expand Down