Skip to content

Commit

Permalink
Fix lists UI queries overriding full lists in selections elsewhere. C…
Browse files Browse the repository at this point in the history
…loses #1400.
  • Loading branch information
knadh committed Jul 20, 2023
1 parent 534c875 commit 0be5901
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down
7 changes: 5 additions & 2 deletions frontend/src/views/Lists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export default Vue.extend({
curItem: null,
isEditing: false,
isFormVisible: false,
lists: [],
queryParams: {
page: 1,
query: '',
Expand Down Expand Up @@ -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;
});
},
Expand Down Expand Up @@ -268,7 +271,7 @@ export default Vue.extend({
},
computed: {
...mapState(['loading', 'lists', 'settings']),
...mapState(['loading', 'settings']),
},
mounted() {
Expand Down

0 comments on commit 0be5901

Please sign in to comment.