Skip to content

Commit 6c341b5

Browse files
authored
fix(ui): sanitize limit for preferences (#8913)
### What? Fixes the issue with passing a string `limit` value from user preferences to the mongodb `.aggregate` function. To reproduce: - click the list view for a collection that has a join field - set "show per page" to 100 - reload, see this: <img width="1001" alt="image" src="https://github.com/user-attachments/assets/86c644d1-d183-48e6-bf34-0ccac23cb114"> ### Why? When using `.aggregate`, MongoDB doesn't cast a value for the `$limit` stage to a number automatically as it's not handled by Mongoose. It's also more convenient to store this value as a number. ### How? Stores `limit` inside of preferences in number.
1 parent 9c530e4 commit 6c341b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ui/src/providers/ListQuery/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const ListQueryProvider: React.FC<ListQueryProps> = ({
9898
let updatePreferences = false
9999

100100
if ('limit' in query) {
101-
updatedPreferences.limit = query.limit
101+
updatedPreferences.limit = Number(query.limit)
102102
updatePreferences = true
103103
}
104104

0 commit comments

Comments
 (0)