Skip to content

Commit

Permalink
Fixes #37587 - cast page and perPage to Number
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Aug 29, 2024
1 parent fd21a88 commit c295cfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v2/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def metadata_page
end

def metadata_per_page
@per_page ||= Setting[:entries_per_page] if params[:per_page].blank?
@per_page ||= params[:per_page] == 'all' ? metadata_total : params[:per_page].to_i
@per_page ||= Setting[:entries_per_page].to_i if params[:per_page].blank?
@per_page ||= params[:per_page] == 'all' ? metadata_total.to_i : params[:per_page].to_i
end

# For the purpose of ADDING/REMOVING associations in CHILD node on POST/PUT payload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ const TableIndexPage = ({
can_create: canCreate,
results,
total,
per_page: perPage,
page,
per_page: respPerPage,
page: respPage,
subtotal,
message: errorMessage,
},
status = STATUS.PENDING,
setAPIOptions,
} = response;
const page = Number(respPage);
const perPage = Number(respPerPage);

const memoDefaultSearchProps = useMemo(
() => getControllerSearchProps(controller),
Expand Down

0 comments on commit c295cfb

Please sign in to comment.