-
Notifications
You must be signed in to change notification settings - Fork 105
feat : csm pagination view #937
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
chae-dahee
merged 11 commits into
githru:core/CSMDict
from
chae-dahee:feature/#912_csm-pagination-view
Oct 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
38ff5f1
fix(engine): Change nextCommitId from null to undefined
4c96949
feat(view): Implement load more functionality
b719637
feat(view): analyzed data handling with pagination
c7d24de
feat(view): update Adapter sendFetchAnalyzedDataMessage
8ec6bc7
feat(vscode): analyzed data structure for pagination
c169ab7
refactore(engine): initialization, caching logic
a2c6440
feat(vscode): add type, update cache logic
dc7bca1
fix(view): add constant, update imports
3271bec
feat(view): update payload types for analyzed data and refresh requests
39b4105
fix(vscode): refresh, changed branch caching logic
a83fbcc
refactor: perPage → commitCountPerPage
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ export default class WebviewLoader implements vscode.Disposable { | |
| const { fetchClusterNodes, fetchBranches, fetchCurrentBranch, fetchGithubInfo } = fetcher; | ||
| const viewColumn = vscode.ViewColumn.One; | ||
|
|
||
| console.log("Initialize cache data"); | ||
| context.workspaceState.keys().forEach((key) => { | ||
| context.workspaceState.update(key, undefined); | ||
| }); | ||
|
|
@@ -35,50 +34,47 @@ export default class WebviewLoader implements vscode.Disposable { | |
| try { | ||
| const { command, payload } = message; | ||
|
|
||
| if (command === "fetchAnalyzedData" || command === "refresh") { | ||
| try { | ||
| const requestPayload = payload ? JSON.parse(payload) : {}; | ||
| const { baseBranchName, perPage, lastCommitId } = requestPayload; | ||
| const currentBranch = baseBranchName ?? (await fetchCurrentBranch()); | ||
|
|
||
| if (perPage) { | ||
| console.log(`Paging request: perPage=${perPage}, lastCommitId=${lastCommitId}`); | ||
| const clusterData = await fetchClusterNodes(currentBranch, perPage, lastCommitId); | ||
| analyzedData = { | ||
| ...clusterData, | ||
| isLoadMore: !!lastCommitId, | ||
| }; | ||
| } else { | ||
| const cacheKey = `${ANALYZE_DATA_KEY}_${currentBranch}`; | ||
| // "refresh": ignore the cache | ||
| // "fetchAnalyzedData": use the cache if exists | ||
| const storedAnalyzedData = | ||
| command === "fetchAnalyzedData" ? context.workspaceState.get<ClusterNode[]>(cacheKey) : undefined; | ||
|
|
||
| if (storedAnalyzedData) { | ||
| console.log("Cache data exists"); | ||
| analyzedData = storedAnalyzedData; | ||
| } else { | ||
| console.log(command === "refresh" ? "Forced refresh: fetching new data" : "No cache Data"); | ||
| analyzedData = await fetchClusterNodes(currentBranch); | ||
| context.workspaceState.update(cacheKey, analyzedData); | ||
| } | ||
| console.log("Current Stored data"); | ||
| context.workspaceState.keys().forEach((key) => { | ||
| console.log(key); | ||
| }); | ||
| } | ||
|
|
||
| const resMessage = { | ||
| command, | ||
| payload: analyzedData, | ||
| }; | ||
| if (command === "refresh") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. command가 늘어났네요!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵! 리팩토링 단계에서 작업해보겠습니다 |
||
| const requestPayload = payload ? JSON.parse(payload) : {}; | ||
| const { selectedBranch, perPage, lastCommitId } = requestPayload; | ||
| const currentBranch = selectedBranch ?? (await fetchCurrentBranch()); | ||
|
|
||
| const clusterData = await fetchClusterNodes(currentBranch, perPage, lastCommitId, "refresh"); | ||
| analyzedData = { | ||
| ...clusterData, | ||
| isLoadMore: !!lastCommitId, | ||
| }; | ||
|
|
||
| await this.respondToMessage({ | ||
| command, | ||
| payload: analyzedData, | ||
| }); | ||
| } | ||
|
|
||
| if (command === "fetchAnalyzedData") { | ||
| const requestPayload = payload ? JSON.parse(payload) : {}; | ||
| const { baseBranch, perPage, lastCommitId } = requestPayload; | ||
| const currentBranch = baseBranch ?? (await fetchCurrentBranch()); | ||
|
|
||
| await this.respondToMessage(resMessage); | ||
| } catch (e) { | ||
| console.error("Error fetching analyzed data:", e); | ||
| throw e; | ||
| const cacheKey = `${ANALYZE_DATA_KEY}_${currentBranch}_${lastCommitId || "firstPage"}`; | ||
|
|
||
| const storedAnalyzedData = context.workspaceState.get<ClusterNodesResult>(cacheKey); | ||
|
|
||
| if (storedAnalyzedData) { | ||
| analyzedData = storedAnalyzedData; | ||
| } else { | ||
| const clusterData = await fetchClusterNodes(currentBranch, perPage, lastCommitId); | ||
| analyzedData = { | ||
| ...clusterData, | ||
| isLoadMore: !!lastCommitId, | ||
| }; | ||
| context.workspaceState.update(cacheKey, analyzedData); | ||
| } | ||
|
|
||
| await this.respondToMessage({ | ||
| command, | ||
| payload: analyzedData, | ||
| }); | ||
| } | ||
|
|
||
| if (command === "fetchBranchList") { | ||
|
|
@@ -173,7 +169,7 @@ export default class WebviewLoader implements vscode.Disposable { | |
|
|
||
| type GithruFetcher<D = unknown, P extends unknown[] = []> = (...params: P) => Promise<D>; | ||
| type GithruFetcherMap = { | ||
| fetchClusterNodes: GithruFetcher<ClusterNodesResult, [string?, number?, string?]>; | ||
| fetchClusterNodes: GithruFetcher<ClusterNodesResult, [string?, number?, string?, string?]>; | ||
| fetchBranches: GithruFetcher<{ branchList: string[]; head: string | null }>; | ||
| fetchCurrentBranch: GithruFetcher<string>; | ||
| fetchGithubInfo: GithruFetcher<{ owner: string; repo: string }>; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
불필요한 주석, 콘솔 제거랑 코드 정리가 잘 되어있어서 가독성이 훨씬 좋아졌어요!