Skip to content

[OP-19305] Enforce order of subheader slots/quickfilters - #469

Merged
HDinger merged 3 commits into
mainfrom
feature/op-19305-enforce-order-of-subheader-slots-quickfilters
Jun 11, 2026
Merged

[OP-19305] Enforce order of subheader slots/quickfilters#469
HDinger merged 3 commits into
mainfrom
feature/op-19305-enforce-order-of-subheader-slots-quickfilters

Conversation

@HDinger

@HDinger HDinger commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

What are you trying to accomplish?

Introduce specific slots for sort and group quick filters to ensure the order is enforced

List the issues that this change affects.

https://community.openproject.org/wp/OP-19305

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.

@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b951013

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openproject/primer-view-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

⚠️ Visual or ARIA snapshot differences found

Our visual and ARIA snapshot tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review differences

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces dedicated sort_quick_filter and group_quick_filter slots to Primer::OpenProject::SubHeader so their rendering order is enforced ahead of the existing quick_filters collection, and updates previews/tests accordingly.

Changes:

  • Added with_sort_quick_filter and with_group_quick_filter slots and enforced their render order before other quick filters.
  • Updated before_render logic so sort/group count toward the max quick-filter limit, but do not affect the filter-button requirement.
  • Added component tests and updated the Lookbook preview; included a changeset for the new API.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/components/primer/open_project/sub_header.rb Adds sort_quick_filter/group_quick_filter slots and updates quick-filter counting logic.
app/components/primer/open_project/sub_header.html.erb Renders sort/group slots before the existing quick_filters loop.
test/components/primer/open_project/sub_header_test.rb Adds coverage for the new slots and ordering/counting behavior.
previews/primer/open_project/sub_header_preview/quick_filters.html.erb Demonstrates the new sort/group quick-filter slots in the preview.
.changeset/empty-poets-occur.md Declares a minor release for the new slots.

Comment thread app/components/primer/open_project/sub_header.rb Outdated
@HDinger
HDinger force-pushed the feature/op-19305-enforce-order-of-subheader-slots-quickfilters branch from 69f4c16 to d51cc25 Compare June 11, 2026 05:57
@myabc
myabc requested a review from Copilot June 11, 2026 10:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Comment thread app/components/primer/open_project/sub_header.rb Outdated
Comment thread app/components/primer/open_project/sub_header.rb Outdated

@myabc myabc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good 👍🏻

I have a couple suggestions, but they are not blockers:

  1. naming: sort and group are not quick filters, per sé - even if they reuse the QuickFilter implementation.
  2. DRY up quick filter slots - perhaps with a build_quick_filter(**kwargs) (similar to ActionList#build_item)
  3. fail fast: if you implement 2, you could also consider crashing earlier on - when the slot method is called rather than at before_render.
def initialize(...)
  # ...
  @filter_count = 0
end

def build_quick_filter(**kwargs)
  raise ArgumentError, "SubHeader supports a maximum of 5 quick_filters" if @filter_count > 5
  deny_tag_argument(**kwargs)
  kwargs[:tag] = :div
  kwargs[:mr] ||= 2

  @filter_count += 1
  QuickFilter.new(**kwargs)
end

Comment thread app/components/primer/open_project/sub_header.rb
Comment thread app/components/primer/open_project/sub_header.rb Outdated
Comment thread app/components/primer/open_project/sub_header.rb Outdated
Comment thread app/components/primer/open_project/sub_header.html.erb Outdated
Comment thread app/components/primer/open_project/sub_header.rb Outdated
@HDinger
HDinger force-pushed the feature/op-19305-enforce-order-of-subheader-slots-quickfilters branch from 6290ad6 to c30bff1 Compare June 11, 2026 12:15
@HDinger
HDinger force-pushed the feature/op-19305-enforce-order-of-subheader-slots-quickfilters branch from c30bff1 to 76f0739 Compare June 11, 2026 12:19
@HDinger
HDinger merged commit 481fd59 into main Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants