Skip to content

Conversation

@mkrasnitski
Copy link
Collaborator

@mkrasnitski mkrasnitski commented Oct 7, 2025

Labels are a new top-level component only supported in modals that can hold a Text Input, Select Menu, or File Upload (another new component) inside it. Oddly enough, the label and description are removed from the label payload when sent back as part of a modal response. See the docs.

Text Inputs inside Action Rows are deprecated, therefore I removed the InputText variant for ActionRowComponent. Also, at the moment modals can include Action Rows, Text Displays, and Labels as top-level components, so I changed modal responses to store Component instead of ActionRow and added a text method to quick modals. I thought about adding select menu support to quick modals but the methods felt a little too verbose.

@github-actions github-actions bot added model Related to the `model` module. builder Related to the `builder` module. examples Related to Serenity's examples. collector Related to the `collector` module. labels Oct 7, 2025
@github-actions github-actions bot removed the examples Related to Serenity's examples. label Oct 7, 2025
@GnomedDev
Copy link
Member

Why remove StaticU8? I'm fine with it, as it's a minor performance opt, but I just want the reason written down somewhere.

@mkrasnitski
Copy link
Collaborator Author

The CreateButton and CreateInputText structs have a kind field of type ComponentType already, so this is an inconsistency that I wanted to resolve. Also, ComponentType is a fake enum since it uses the enum_number! macro, meaning it's actually a newtype around u8, same as StaticU8. I'll make a follow-up PR removing the kind fields entirely and just inserting it at serialization time, since it doesn't serve any other purpose.

@DPlayer234
Copy link
Contributor

Wasn't that the point of StaticU8? It was a ZST that would serialize an integer but not take up any memory at runtime.

@mkrasnitski mkrasnitski force-pushed the label-component branch 2 times, most recently from 8eeab73 to 066e551 Compare October 20, 2025 18:54
@mkrasnitski mkrasnitski changed the title Add support for Label components Add support for Label and File Upload components Oct 21, 2025
@mkrasnitski
Copy link
Collaborator Author

I've gone ahead and also added support for the new File Upload component, as it can only be found inside a Label.

Wasn't that the point of StaticU8? It was a ZST that would serialize an integer but not take up any memory at runtime.

I didn't realize it was a ZST, however I do still think that for now, ComponentType is clearer, given that the variants can be named instead of being bare integers.

@calum4
Copy link
Contributor

calum4 commented Nov 26, 2025

I've been using this branch (thank you) and unfortunately discovered an issue.

In my testing, all Select Menu interaction responses originating from a modal include the values field, however this is not currently present in the serenity SelectMenu model.

On a fork of this branch, I have applied a fix which you can find here.

I have also created an MRE which I used to test said fix which you can find here. By default the serenity crate is built from your latest commit bc37312. In Cargo.toml I have included a commented out a dependency to use my fix.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builder Related to the `builder` module. collector Related to the `collector` module. model Related to the `model` module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants