Skip to content
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

[#59391] rework file links to paginated collection #17230

Conversation

Kharonus
Copy link
Member

Ticket

OP#59391

What are you trying to accomplish?

  • show again a correct counter on the files tab in work package detail view

What approach did you choose and why?

  • files tab counter now only calls for file links of wp with page size 0
  • file links endpoint returns paginated collections
  • frontend requests file links with page size -1 (INFINITE)
  • file sync is still executed for ALL file links of a work package, not only the requested page
    • this is practically no change for the product, as we do not fetch single pages
    • but fetching only the total numbers with page size 0 now does not trigger a sync

@Kharonus Kharonus requested a review from a team November 19, 2024 13:38
@Kharonus Kharonus self-assigned this Nov 19, 2024
@Kharonus Kharonus force-pushed the bug/59391-files-count-badge-missing-in-files-tab-wp-full-view branch from aebba26 to b13c7d0 Compare November 19, 2024 15:22
Copy link
Contributor

@brunopagno brunopagno left a comment

Choose a reason for hiding this comment

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

Code changes look good to me. I am assuming the pagination change is considered a non breaking API change and thus can be included without any issues to consumers.

🎉

@Kharonus
Copy link
Member Author

@brunopagno This is an important point. My take on it would be, that usage of it is in the most cases the same. If you do not define a pagesize, you get a standard back. only if you have more then 30 file links in one collection, you suddenly won't get all back.

This could be considered breaking, but the solution for it is quite simple and needs only adding a pageSize=-1 to the request's query params.

@Kharonus Kharonus requested a review from apfohl November 20, 2024 12:20
- https://community.openproject.org/wp/59391
- files tab counter now only calls for file links of wp with page size 0
- file links endpoint returns paginated collections
- frontend requests file links with page size -1 (INFINITE)
- file sync is still executed for ALL file links of a work package, not
  only the requested page
  - this is practically no change for the product, as we do not fetch
    single pages
  - but fetching only the total numbers with page size 0 now does not
    trigger a sync
- avoid sql injection
- file link collection is returned ordered by id asc
@Kharonus Kharonus force-pushed the bug/59391-files-count-badge-missing-in-files-tab-wp-full-view branch from 9ca4a05 to e86d5bd Compare November 20, 2024 12:25
@brunopagno
Copy link
Contributor

This could be considered breaking, but the solution for it is quite simple and needs only adding a pageSize=-1 to the request's query params.

@Kharonus the behaviour change could be considered breaking. Do we have any previous events similar to this to take into account? Would be nice if the decision was made for us 😅

I personally do not feel the change is a big deal, but if any consumer depends on this behaviour they could be annoyed, even if the fix on the client side is simple.

@Kharonus
Copy link
Member Author

Well, TBH in the past we did not really bothered with breaking changes to the API. We renamed properties, changed JSON representations, and still released them without a deprecation round.

For this thing here a deprecation round would be adding this behavior behind some kind of feature flag.

It is possible, but it would raise of course again the question, if the change is breaking enough. It should not happen, that all custom clients suddenly break. And for those, where big collections are an issue, the fix is rather simple.

@brunopagno
Copy link
Contributor

@Kharonus sounds good enough to me. Thanks for the context there 🙇

@Kharonus Kharonus merged commit 8ecfc43 into release/15.0 Nov 21, 2024
15 checks passed
@Kharonus Kharonus deleted the bug/59391-files-count-badge-missing-in-files-tab-wp-full-view branch November 21, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants