Skip to content

Component Flattener does not pop styles of nested components in correct order #1254

@diogotcorreia

Description

@diogotcorreia

Take the following component:

final Component input = Component.text()
      .content("Hi there my")
      .append(Component.text(" clickable ")
        .clickEvent(ClickEvent.copyToClipboard("some text")
        .append(
          Component.text("and blue ", NamedTextColor.BLUE)))
      .append(Component.text("friend"))
      .build();

Until Adventure 4.22.0, this would pop in the following order:

  • blue
  • click event
  • empty
  • emtpy

Which is expected and correct. As of 4.22.0 (specifically, PR #1237), this is no longer the case, and it is popped in this order:

  • blue
  • empty
  • click event
  • empty

This happens because the new implementation does not have any code to pop the styles of components that have children, so they are popped at the end only, which is incorrect.

cc PR author @kezz

I've made a fix and will submit a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions