Skip to content

FIX Don't make a count query when threshold = 0#11646

Merged
GuySartorelli merged 3 commits intosilverstripe:5.3from
lekoala:patch-69
Apr 8, 2025
Merged

FIX Don't make a count query when threshold = 0#11646
GuySartorelli merged 3 commits intosilverstripe:5.3from
lekoala:patch-69

Conversation

@lekoala
Copy link
Copy Markdown
Contributor

@lekoala lekoala commented Mar 24, 2025

This is a partial fix for #11645

It avoids count queries when dropdown_field_threshold is set to 0

Everything will work the same as before, but with a very small difference: empty tables will now lazy load, but I think that's acceptable

It will also prevent setting a limit of 0

Description

See issue for context

Manual testing steps

Set the dropdown_field_threshold to 0
See that no more count queries are made during scaffolding

Issues

#11645

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

@lekoala
Copy link
Copy Markdown
Contributor Author

lekoala commented Mar 24, 2025

@GuySartorelli I also took the opportunity to avoid setting the limit of items if threshold is 0. I'm not even sure why the threshold value is used as the lazy load limit, as this seems two different things

Copy link
Copy Markdown
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GuySartorelli GuySartorelli merged commit 6b437a5 into silverstripe:5.3 Apr 8, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants