Skip to content

fix: always return count of workspaces #12407

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

Merged
merged 3 commits into from
Mar 5, 2024
Merged

fix: always return count of workspaces #12407

merged 3 commits into from
Mar 5, 2024

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Mar 4, 2024

Related: #11795
Related: #12380

This PR ensures that /workspaces API endpoint always returns a count with the total number of workspaces. This is a simpler and alternative version to #12380.

Once it is merged, @BrunoQuaresma can work on the final adjustments on the FE side.

@mtojek mtojek self-assigned this Mar 4, 2024
@mtojek mtojek requested review from johnstcn and mafredri March 4, 2024 15:10
@mtojek mtojek marked this pull request as ready for review March 4, 2024 15:10
@mtojek mtojek requested a review from BrunoQuaresma March 4, 2024 15:12
@BrunoQuaresma
Copy link
Collaborator

Which adjustments do you think would be necessary?

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

I'm not 100% sold on the technical summary row. While it's not strictly compatibility-breaking, it's something that older clients won't know how to handle properly.

That having been said, if it can be an opt-in flag, then it's not a problem at all. Maybe we add a &withSummary=true query parameter to the /api/v2/workspaces endpoint as well and plumb that through? We can make it the default after a couple of releases.

EDIT: I misinterpreted -- this is all happening on the backend, so clients don't come into it at all. I think this is fine then 👍

@mtojek
Copy link
Member Author

mtojek commented Mar 4, 2024

That having been said, if it can be an opt-in flag, then it's not a problem at all. Maybe we add a &withSummary=true query parameter to the /api/v2/workspaces endpoint as well and plumb that through? We can make it the default after a couple of releases.

Oh, but API does not leak the technical row, right? From API perspective the only change is the "count" value. Is that what you meant?

@mtojek
Copy link
Member Author

mtojek commented Mar 4, 2024

@BrunoQuaresma

Basically this:

or even the right count for the number of workspaces so we can check if a pagination is wrong by doing some extra calculations.

from your comment

@johnstcn
Copy link
Member

johnstcn commented Mar 4, 2024

Oh, but API does not leak the technical row, right? From API perspective the only change is the "count" value. Is that what you meant?

Yeah, I was wondering if the technical row would show up as a "dummy" workspace in the API response. But that does not appear to be the case, correct?

@mtojek
Copy link
Member Author

mtojek commented Mar 4, 2024

That would be a developer error, and there is no point in doing this. Also, it is disabled by default.

@mtojek mtojek merged commit e4fa212 into main Mar 5, 2024
@mtojek mtojek deleted the 11795-last-page-2 branch March 5, 2024 08:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants