Fix lists UI queries overriding full lists in selections elsewhere. Closes #1400.

This commit is contained in:
Kailash Nadh 2023-07-20 23:46:00 +05:30
parent 534c87509a
commit 0be5901df7
3 changed files with 12 additions and 3 deletions

View file

@ -168,7 +168,7 @@ export default Vue.extend({
mounted() {
// Lists is required across different views. On app load, fetch the lists
// and have them in the store.
this.$api.getLists({ minimal: true });
this.$api.getLists({ minimal: true, per_page: 'all' });
window.addEventListener('resize', () => {
this.windowWidth = window.innerWidth;

View file

@ -115,6 +115,12 @@ export const getLists = (params) => http.get('/api/lists',
store: models.lists,
});
export const queryLists = (params) => http.get('/api/lists',
{
params: (!params ? { per_page: 'all' } : params),
loading: models.lists,
});
export const getList = async (id) => http.get(`/api/lists/${id}`,
{ loading: models.list });

View file

@ -173,6 +173,7 @@ export default Vue.extend({
curItem: null,
isEditing: false,
isFormVisible: false,
lists: [],
queryParams: {
page: 1,
query: '',
@ -228,11 +229,13 @@ export default Vue.extend({
},
getLists() {
this.$api.getLists({
this.$api.queryLists({
page: this.queryParams.page,
query: this.queryParams.query,
order_by: this.queryParams.orderBy,
order: this.queryParams.order,
}).then((resp) => {
this.lists = resp;
});
},
@ -268,7 +271,7 @@ export default Vue.extend({
},
computed: {
...mapState(['loading', 'lists', 'settings']),
...mapState(['loading', 'settings']),
},
mounted() {