Skip to content

Conversation

hanspagel
Copy link
Member

@hanspagel hanspagel commented Jul 4, 2025

⚠️ Triggers a minor version bump for @scalar/api-reference
⚠️ If there’s something wrong it might affect a large number of users.

Problem

When passing tagsSorter: 'alpha' the order of the tags in the content doesn’t match the order in the sidebar.

We’re using a completely different logic to render the sidebar (new) and the main content (old).

Solution

This PR refactors how we loop through tags, tag groups, operations and webhooks in the content to re-use the logic from the sidebar, and those felt unavoidable:

  • refactored a bunch of components to not use the deprecated TransformedOperation anymore
  • moved the code to render the introduction, the operations and the webhooks, and the models to their own components
  • added tests to <HttpMethod />, <OperationsList /> and the new <Content />
  • adds tests to verify tagsSorter and operationsSorter work correctly when rendering the <Content /> (see Using a ///<summary>test</summary> is affecting sort order of tags #6062)
  • Moved <OperationsList /> to components/, added tests

And a bunch of other minor tweaks and bug fixes. 🥴

Fixes #6062
Fixes #6049
Fixes #5744

Checklist

I've gone through the following:

  • I've added an explanation why this change is needed.
  • I've added a changeset (pnpm changeset).
  • I've added tests for the regression or new feature.
  • I've updated the documentation.

@hanspagel hanspagel self-assigned this Jul 4, 2025
Copy link

changeset-bot bot commented Jul 4, 2025

🦋 Changeset detected

Latest commit: 460bd81

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

This PR includes changesets to release 7 packages
Name Type
@scalar/api-reference Minor
@scalar/aspire Patch
@scalar/aspnetcore Patch
@scalarapi/docker-api-reference Patch
@scalar/fastify-api-reference Minor
@scalar/nuxt Patch
@scalar/api-reference-react Patch

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

@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch 3 times, most recently from f0f3839 to 9d7fe71 Compare July 10, 2025 13:43
@hanspagel hanspagel changed the title fix(api-reference): content order doesn’t match sidebar order refactor(api-reference): new content rendering Jul 11, 2025
@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 1ea39f4 to 9534dad Compare July 11, 2025 09:56
@hanspagel hanspagel marked this pull request as ready for review July 11, 2025 10:45
@hanspagel hanspagel requested a review from marclave as a code owner July 11, 2025 10:45
@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch 2 times, most recently from 1d2f8fb to 6af0866 Compare July 14, 2025 10:40
@amritk amritk force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 00d6d49 to 2247978 Compare July 14, 2025 21:23
Copy link

relativeci bot commented Jul 14, 2025

#11523 Bundle Size — 2.6MiB (-0.1%).

460bd81(current) vs e895f86 main#11521(baseline)

Warning

Bundle contains 3 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Improvement 1 improvement
                 Current
#11523
     Baseline
#11521
Improvement  Initial JS 2.6MiB(-0.1%) 2.61MiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 100% 100%
No change  Chunks 1 1
No change  Assets 1 1
Change  Modules 1759(+0.29%) 1754
No change  Duplicate Modules 0 0
No change  Duplicate Code 0% 0%
No change  Packages 170 170
No change  Duplicate Packages 3 3
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#11523
     Baseline
#11521
Improvement  JS 2.6MiB (-0.1%) 2.61MiB

Bundle analysis reportBranch hanspagel/doc-3647-using-a-summa...Project dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Contributor

github-actions bot commented Jul 14, 2025

@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch 3 times, most recently from 40548ad to 1cec30f Compare July 15, 2025 09:57
@amritk amritk force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 54736fe to a8214d1 Compare July 15, 2025 17:33
@amritk amritk requested a review from geoffgscott as a code owner July 15, 2025 23:40
Copy link
Contributor

github-actions bot commented Jul 16, 2025

Cloudflare Preview for the API Client

https://2f8a1128.client-staging-7m0.pages.dev

@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 3298480 to 82ac382 Compare July 16, 2025 08:09
@amritk amritk force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 5a955cc to 18d54a0 Compare July 16, 2025 17:47
@amritk
Copy link
Member

amritk commented Jul 16, 2025

Alright its good to go, once its merged lets hold release and we should do lazy loading + parameter links at the same time

@amritk
Copy link
Member

amritk commented Jul 16, 2025

This will be conflicted until I revert my revert

@amritk amritk added the on hold label Jul 16, 2025
@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 8e05c01 to 0cbb157 Compare July 17, 2025 12:41
@amritk
Copy link
Member

amritk commented Jul 18, 2025

@marclave give it a go!

@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from 4cc5b80 to da61ace Compare July 21, 2025 09:22
hanspagel and others added 25 commits July 21, 2025 14:29
refactor: move section flare to its own component, rename tags folder, clean up

refactor: move everything to sections

fix: broken imports

refactor: decoiple models section from config

fix: persistAuth of undefined

refactor: use traverseTags

refactor: render all tags

chore: add tasks

chore: clean up

refactor: remove old loops, render operations in new loop

refactor: drop the parsedSpec from the OperationsSection, yay!

chore: extend the example

feat: render taggroups

feat: loop through untagged webhooks, too (wip), clean up

chore: add some examples, will remove it later (wip)

chore: add comments, update tag accordion

chore: clean up

chore: clean up

fix: webhooks section has empty operations list

fix: operations with just the default tag aren’t rendered

chore: clean up

chore: clean up

refactor: move OperationsList to its own component

test: OperationsList

refactor: make the tests simpler

test: HttpMethod

chore: delete unused files

test: OperationsSection

chore: clean up

test: enhance OperationsSection tests with tag grouping and webhooks

test: restructure

chore: disable show more for now (wip)

fix: all sections are collapsed by default

fix: broken classic layout

fix: can’t expand tags

refactor: remove duplicate props

refactor: Lazy component, add tests

test: Lazy

chore: clean up

refactor: clean up props

refactor: rename components

refactor: move more components around

refactor: rename test

fix: broken import

refactor: remove duplicate prop

chore: remove debug output

chore: clean up

chore: ignore old component

fix: does not expand all tags if their is only one default tag

fix: test doesn’t see collapsed tags

test: tagsSorter and operationsSorter

docs(changeset): refactor: new main content rendering

fix: build issues

test: Tags/ClassicLayout

test: Tags/ModernLayout

test: clean up tests for Tags/ModernLayout

test: Tags/Tag

test: Tags/TagSection

test: add more tests to Tags/TagSection

test: Models/Models

chore: restore old name for content
@hanspagel hanspagel force-pushed the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch from da61ace to 460bd81 Compare July 21, 2025 12:30
@hanspagel hanspagel merged commit 2e2f50a into main Jul 21, 2025
38 checks passed
@hanspagel hanspagel deleted the hanspagel/doc-3647-using-a-summarytestsummary-is-affecting-sort-order-of-tags branch July 21, 2025 12:44
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.

Using a ///<summary>test</summary> is affecting sort order of tags api-reference breaks in there's a tag named default in schema No more parsedSpec
2 participants