Skip to content

Commit

Permalink
Fixed: itemsPerPage not respected on backend in useVingKind() #169
Browse files Browse the repository at this point in the history
* Fixed: fix pager component, doesn't currently switch pages #170
  • Loading branch information
rizen committed Jun 25, 2024
1 parent 8027b28 commit d50803a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/components/ving/Pager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<script setup>
const props = defineProps(['kind']);
function changePage(page) {
props.kind.query = {...props.kind.query, page };
function changePage(pager) {
props.kind.query.page = pager.page;
props.kind.search();
}
</script>
14 changes: 7 additions & 7 deletions app/composables/ving/useVingKind.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VingKind {
})

/**
* The object where new properties are stored awaiting being sent to the server to create the record for real. Note that this is generated `set`/`get` and thus you must set a full object if you set it.
* The object where new properties are stored awaiting being sent to the server to create the record for real.
*/

get new() {
Expand All @@ -32,7 +32,7 @@ class VingKind {
}

/**
* The object containing paging data. Note that this is generated `set`/`get` and thus you must set a full object if you set it.
* The object containing paging data.
*/
get paging() {
return this.#state.paging;
Expand All @@ -43,7 +43,7 @@ class VingKind {
}

/**
* The object containing enumerated props options once `fetchPropsOptions` is called. Note that this is generated `set`/`get` and thus you must set a full object if you set it.
* The object containing enumerated props options once `fetchPropsOptions` is called.
*/
get propsOptions() {
return this.#state.propsOptions;
Expand All @@ -54,7 +54,7 @@ class VingKind {
}

/**
* An object containing the query parameters to send when interacting with endpoints for this kind. Note that this is generated `set`/`get` and thus you must set a full object if you set it.
* An object containing the query parameters to send when interacting with endpoints for this kind.
*/

get query() {
Expand All @@ -66,7 +66,7 @@ class VingKind {
}

/**
* An array containing the list of records that have been fetched from the server. Note that this is generated `set`/`get` and thus you must set a full array if you set it.
* An array containing the list of records that have been fetched from the server.
*/
get records() {
return this.#state.records;
Expand Down Expand Up @@ -149,7 +149,7 @@ class VingKind {
*/
async call(method, url, query = {}, options = {}) {
const response = await useRest(url, {
query: defu({}, this.query, query),
query: defu({}, query, this.query),
method,
suppressErrorNotifications: this.#behavior.suppressErrorNotifications,
});
Expand Down Expand Up @@ -438,7 +438,7 @@ class VingKind {
page: options?.page || this.paging.page || 1,
itemsPerPage: this.paging.itemsPerPage || 10,
};
const query = defu({}, pagination, options?.query, this.query);
const query = defu({}, options?.query, this.query, pagination);

const response = await useRest(this.getListApi(), {
query: query,
Expand Down
2 changes: 2 additions & 0 deletions ving/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ outline: deep
### 2024-06-24
* Fixed: pager appears to be broken #167
* Rewrote the `all` method in useVingKind to be more clear and simple.
* Fixed: itemsPerPage not respected on backend in useVingKind() #169
* Fixed: fix pager component, doesn't currently switch pages #170

### 2024-06-23
* Fixed: examples in VingSchema need to differentiate between the able and the kind class #155
Expand Down

0 comments on commit d50803a

Please sign in to comment.