dosubot[bot] commented on issue #8805:
URL: 
https://github.com/apache/incubator-devlake/issues/8805#issuecomment-4236027799

   <!-- Answer -->
   Looking into this further, the missing pagination in SonarQube search 
appears to be a real bug stemming from an architectural mismatch between the 
frontend and backend:
   
   **Root cause**: The backend search helper 
([`DsRemoteApiScopeSearchHelper`](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/helpers/pluginhelper/api/ds_remote_api_scope_search_helper.go#L76-L82))
 does **not** return a `nextPageToken` in the response — it only returns `page` 
and `pageSize`. Meanwhile, the frontend uses an infinite-scroll mechanism that 
relies on a loading state signal to decide whether more results exist 
[[1]](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx#L212).
 Once the first page finishes loading, the UI concludes there's nothing more to 
fetch, so pagination effectively never kicks in.
   
   This is different from the **list** endpoint (`DsRemoteApiScopeListHelper`), 
which *does* return `nextPageToken` properly 
[[2]](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/helpers/pluginhelper/api/ds_remote_api_scope_list_helper.go#L91-L96).
 So the issue is specific to the **search** path and affects all plugins, not 
just SonarQube.
   
   The fix linked in #8407 was about GitHub checkbox state management across 
pages — it didn't address this SonarQube search pagination problem.
   
   There have been several pagination-related fixes merged more recently (e.g., 
[GitLab pagination fix](https://github.com/apache/incubator-devlake/pull/8594), 
[SonarQube API endpoint 
fix](https://github.com/apache/incubator-devlake/pull/8731)), but a fix 
specifically for the search endpoint not returning `nextPageToken` doesn't 
appear to have landed yet. This would likely need changes in both the backend 
search helper to return proper pagination metadata and the frontend to consume 
it.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention 
[@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=too_verbose)
 | [Hallucination](https://
 
app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=e9fc5809-cdc8-4047-baad-e6a634ddf7aa&feedback_type=other)</sup>
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/b4e8e847-d479-4541-83a8-d88d83fea5c9/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Looking%20into%20this%20further%2C%20the%20missing%20pagination%20in%20SonarQube%20search%20appears%20to%20be%20a%20real%20bug%20stemming%20from%20an%20architectural%20mismatch%20between%20the%20frontend%20and%20backend%3A%0A%0A%2A%2ARoot%20cause%2A%2A%3A%20The%20backend%20search%20helper%20%28%5B%60DsRemoteApiScopeSearchHelper%60%5D%28https%3A//github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/helpers/pluginhelper/api/ds_remote_api_scope_search_helper.go%23L76-L82%29%29%20does%20%2A%2Anot%2A%2A%20return%20a%20%60nextPageToken%60%20in%20the%20response%20%E2%80%94%20it%20only%20returns%20%60page%60%20and%20%60pageSize%60.%20Meanwhile%2
 
C%20the%20frontend%20uses%20an%20infinite-scroll%20mechanism%20that%20relies%20on%20a%20loading%20state%20signal%20to%20decide%20whether%20more%20results%20exist%20%5B%5B1%5D%5D%28https%3A//github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx%23L212%29.%20Once%20the%20first%20page%20finishes%20loading%2C%20the%20UI%20concludes%20there%27s%20nothing%20more%20to%20fetch%2C%20so%20pagination%20effectively%20never%20kicks%20in.%0A%0AThis%20is%20different%20from%20the%20%2A%2Alist%2A%2A%20endpoint%20%28%60DsRemoteApiScopeListHelper%60%29%2C%20which%20%2Adoes%2A%20return%20%60nextPageToken%60%20properly%20%5B%5B2%5D%5D%28https%3A//github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/helpers/pluginhelper/api/ds_remote_api_scope_list_helper.go%23L91-L96%29.%20So%20the%20issue%20is%20specific%20to%20the%20%2A%2Asearch%2A%2A%20path%20and%20affects%20all%20plug
 
ins%2C%20not%20just%20SonarQube.%0A%0AThe%20fix%20linked%20in%20%238407%20was%20about%20GitHub%20checkbox%20state%20management%20across%20pages%20%E2%80%94%20it%20didn%27t%20address%20this%20SonarQube%20search%20pagination%20problem.%0A%0AThere%20have%20been%20several%20pagination-related%20fixes%20merged%20more%20recently%20%28e.g.%2C%20%5BGitLab%20pagination%20fix%5D%28https%3A//github.com/apache/incubator-devlake/pull/8594%29%2C%20%5BSonarQube%20API%20endpoint%20fix%5D%28https%3A//github.com/apache/incubator-devlake/pull/8731%29%29%2C%20but%20a%20fix%20specifically%20for%20the%20search%20endpoint%20not%20returning%20%60nextPageToken%60%20doesn%27t%20appear%20to%20have%20landed%20yet.%20This%20would%20likely%20need%20changes%20in%20both%20the%20backend%20search%20helper%20to%20return%20proper%20pagination%20metadata%20and%20the%20frontend%20to%20consume%20it.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/d
 
iscord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-devlake/issues/8805)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to