Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRP strict field in query #16725

Merged
merged 9 commits into from
Dec 14, 2024

Conversation

Leinnan
Copy link
Contributor

@Leinnan Leinnan commented Dec 9, 2024

Objective

  • Allow skiping components that don't have ComponentId yet instead of failing bevy/query request.

Solution

  • Describe the solution used to achieve the objective above.

Testing

My naive approach boils down to:

  • bevy/list to get list of all components.
  • bevy/query with empty components and has fields and a option that contains result of the bevy/list.

Before that change I end up with bunch of Component xxx isn't used in the world because some of the components wasn't spawned at any moment yet in the game. Now it should work.

Migration Guide

  • BrpQueryParams now has strict boolean field. It serfs as a flag to fail when encountering an invalid component rather than skipping it. Defaults to false.

Copy link
Contributor

@villor villor left a comment

Choose a reason for hiding this comment

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

Very nice addition! 👍

  • Maybe we should also change the response to a Lenient/Strict enum, with errors list included for the Lenient response. That way the client is not kept in the dark about any skipped components. (look at bevy/get)
  • Documentation needs to be updated as well.

@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide A-Dev-Tools Tools used to debug Bevy applications. S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 10, 2024
Copy link
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.

@Leinnan
Copy link
Contributor Author

Leinnan commented Dec 13, 2024

@alice-i-cecile is there anything missing now?

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 14, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 14, 2024
Merged via the queue into bevyengine:main with commit 897ffad Dec 14, 2024
29 checks passed
@Leinnan Leinnan deleted the brp_strict_field_query branch December 14, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dev-Tools Tools used to debug Bevy applications. C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants