Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Add pagination to saved searches pages#45705

Merged
0xnmn merged 3 commits into
mainfrom
naman/saved-searches
Jan 5, 2023
Merged

Add pagination to saved searches pages#45705
0xnmn merged 3 commits into
mainfrom
naman/saved-searches

Conversation

@0xnmn

@0xnmn 0xnmn commented Dec 15, 2022

Copy link
Copy Markdown
Contributor

Closes: https://github.com/sourcegraph/sourcegraph/issues/43623

Use the new cursor-based pagination system to add pagination to Saved Searches pages.

In response to the new breaking changes to the API:

  • Legacy Home Panels which were still available under feature flagged are also removed. Change log added. Approval
  • Updates to the sidebar, which shows saved searches of VS Code extension, are also made to accommodate API changes.

Unit tests are updated for the saved searches page.

Test plan

image

@0xnmn 0xnmn self-assigned this Dec 15, 2022
@cla-bot cla-bot Bot added the cla-signed label Dec 15, 2022
@0xnmn 0xnmn changed the title Naman/saved searches Add pagination to saved searches pages Dec 15, 2022
@0xnmn 0xnmn force-pushed the naman/saved-searches branch 2 times, most recently from aa127e4 to be529f3 Compare December 29, 2022 12:27
@0xnmn 0xnmn marked this pull request as ready for review December 29, 2022 12:33
@0xnmn 0xnmn requested review from a team, mrnugget and philipp-spiess December 29, 2022 12:34
@0xnmn

0xnmn commented Dec 29, 2022

Copy link
Copy Markdown
Contributor Author

@sourcegraph-bot

sourcegraph-bot commented Dec 29, 2022

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 2028ef5...e93e59b.

Notify File(s)
@fkling client/web/src/search/backend.tsx
client/web/src/search/home/SearchPage.story.tsx
client/web/src/search/home/SearchPage.test.tsx
client/web/src/search/home/SearchPage.tsx
client/web/src/search/index.tsx
client/web/src/search/panels/CollaboratorsPanel.module.scss
client/web/src/search/panels/CollaboratorsPanel.story.tsx
client/web/src/search/panels/CollaboratorsPanel.tsx
client/web/src/search/panels/CommunitySearchContextPanel.module.scss
client/web/src/search/panels/CommunitySearchContextPanel.story.tsx
client/web/src/search/panels/CommunitySearchContextPanel.test.tsx
client/web/src/search/panels/CommunitySearchContextPanel.tsx
client/web/src/search/panels/EmptyPanelContainer.module.scss
client/web/src/search/panels/EmptyPanelContainer.tsx
client/web/src/search/panels/FooterPanel.module.scss
client/web/src/search/panels/FooterPanel.tsx
client/web/src/search/panels/HomePanels.module.scss
client/web/src/search/panels/HomePanels.tsx
client/web/src/search/panels/LoadingPanelView.module.scss
client/web/src/search/panels/LoadingPanelView.tsx
client/web/src/search/panels/PanelContainer.module.scss
client/web/src/search/panels/PanelContainer.test.tsx
client/web/src/search/panels/PanelContainer.tsx
client/web/src/search/panels/PanelFragments.tsx
client/web/src/search/panels/RecentFilesPanel.story.tsx
client/web/src/search/panels/RecentFilesPanel.test.tsx
client/web/src/search/panels/RecentFilesPanel.tsx
client/web/src/search/panels/RecentSearchesPanel.module.scss
client/web/src/search/panels/RecentSearchesPanel.story.tsx
client/web/src/search/panels/RecentSearchesPanel.test.tsx
client/web/src/search/panels/RecentSearchesPanel.tsx
client/web/src/search/panels/RepositoriesPanel.story.tsx
client/web/src/search/panels/RepositoriesPanel.test.tsx
client/web/src/search/panels/RepositoriesPanel.tsx
client/web/src/search/panels/SavedSearchesPanel.story.tsx
client/web/src/search/panels/SavedSearchesPanel.test.tsx
client/web/src/search/panels/SavedSearchesPanel.tsx
client/web/src/search/panels/ShowMoreButton.tsx
client/web/src/search/panels/snapshots/CommunitySearchContextPanel.test.tsx.snap
client/web/src/search/panels/snapshots/PanelContainer.test.tsx.snap
client/web/src/search/panels/snapshots/RecentSearchesPanel.test.tsx.snap
client/web/src/search/panels/snapshots/RepositoriesPanel.test.tsx.snap
client/web/src/search/panels/useComputeResults.ts
client/web/src/search/panels/useInviteEmailToSourcegraph.ts
client/web/src/search/panels/utils.ts
@keegancsmith cmd/frontend/graphqlbackend/saved_searches.go
cmd/frontend/graphqlbackend/saved_searches_test.go
@limitedmage client/web/src/integration/search.test.ts
client/web/src/search/backend.tsx
client/web/src/search/home/SearchPage.story.tsx
client/web/src/search/home/SearchPage.test.tsx
client/web/src/search/home/SearchPage.tsx
client/web/src/search/index.tsx
client/web/src/search/panels/CollaboratorsPanel.module.scss
client/web/src/search/panels/CollaboratorsPanel.story.tsx
client/web/src/search/panels/CollaboratorsPanel.tsx
client/web/src/search/panels/CommunitySearchContextPanel.module.scss
client/web/src/search/panels/CommunitySearchContextPanel.story.tsx
client/web/src/search/panels/CommunitySearchContextPanel.test.tsx
client/web/src/search/panels/CommunitySearchContextPanel.tsx
client/web/src/search/panels/EmptyPanelContainer.module.scss
client/web/src/search/panels/EmptyPanelContainer.tsx
client/web/src/search/panels/FooterPanel.module.scss
client/web/src/search/panels/FooterPanel.tsx
client/web/src/search/panels/HomePanels.module.scss
client/web/src/search/panels/HomePanels.tsx
client/web/src/search/panels/LoadingPanelView.module.scss
client/web/src/search/panels/LoadingPanelView.tsx
client/web/src/search/panels/PanelContainer.module.scss
client/web/src/search/panels/PanelContainer.test.tsx
client/web/src/search/panels/PanelContainer.tsx
client/web/src/search/panels/PanelFragments.tsx
client/web/src/search/panels/RecentFilesPanel.story.tsx
client/web/src/search/panels/RecentFilesPanel.test.tsx
client/web/src/search/panels/RecentFilesPanel.tsx
client/web/src/search/panels/RecentSearchesPanel.module.scss
client/web/src/search/panels/RecentSearchesPanel.story.tsx
client/web/src/search/panels/RecentSearchesPanel.test.tsx
client/web/src/search/panels/RecentSearchesPanel.tsx
client/web/src/search/panels/RepositoriesPanel.story.tsx
client/web/src/search/panels/RepositoriesPanel.test.tsx
client/web/src/search/panels/RepositoriesPanel.tsx
client/web/src/search/panels/SavedSearchesPanel.story.tsx
client/web/src/search/panels/SavedSearchesPanel.test.tsx
client/web/src/search/panels/SavedSearchesPanel.tsx
client/web/src/search/panels/ShowMoreButton.tsx
client/web/src/search/panels/snapshots/CommunitySearchContextPanel.test.tsx.snap
client/web/src/search/panels/snapshots/PanelContainer.test.tsx.snap
client/web/src/search/panels/snapshots/RecentSearchesPanel.test.tsx.snap
client/web/src/search/panels/snapshots/RepositoriesPanel.test.tsx.snap
client/web/src/search/panels/useComputeResults.ts
client/web/src/search/panels/useInviteEmailToSourcegraph.ts
client/web/src/search/panels/utils.ts
@rvantonder cmd/frontend/graphqlbackend/saved_searches.go
cmd/frontend/graphqlbackend/saved_searches_test.go

@0xnmn 0xnmn force-pushed the naman/saved-searches branch from be529f3 to 328ef63 Compare January 2, 2023 09:08
@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Jan 2, 2023

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
-0.02% (-0.57 kb) 0.00% (+0.53 kb) 0.01% (+1.10 kb) 0.28% (+2) 🔺

Look at the Statoscope report for a full comparison between the commits e93e59b and 2028ef5 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@0xnmn 0xnmn force-pushed the naman/saved-searches branch from 328ef63 to 8e51629 Compare January 2, 2023 14:32
@0xnmn 0xnmn requested review from limitedmage and vdavid January 2, 2023 14:36
@0xnmn

0xnmn commented Jan 2, 2023

Copy link
Copy Markdown
Contributor Author

Blocked on decision from: https://sourcegraph.slack.com/archives/C03CSAER9LK/p1672317171091039

Resolved!

@0xnmn 0xnmn force-pushed the naman/saved-searches branch 2 times, most recently from cae55b0 to 72eb723 Compare January 2, 2023 16:22

@limitedmage limitedmage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Frontend code looks good, left some comments to be addressed. Please have someone else review the backend Go code 😅

Comment thread schema/settings.schema.json Outdated
Comment thread client/web/src/search/home/SearchPage.story.tsx Outdated

@mrnugget mrnugget left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only looked at the Go code for now. Left some comments. I think some of them should be implemented, especially the org-membership test, etc.

Comment thread cmd/frontend/graphqlbackend/saved_searches.go Outdated
Comment thread cmd/frontend/graphqlbackend/saved_searches.go Outdated
Comment thread cmd/frontend/graphqlbackend/saved_searches.go Outdated
Comment thread cmd/frontend/graphqlbackend/saved_searches.go Outdated
Comment thread cmd/frontend/graphqlbackend/saved_searches.go Outdated
Comment thread cmd/frontend/graphqlbackend/schema.graphql Outdated
Comment thread internal/database/saved_searches.go Outdated
Comment thread internal/database/saved_searches.go Outdated
Comment thread internal/database/saved_searches.go Outdated
Comment thread internal/database/saved_searches.go Outdated
Comment thread schema/settings.schema.json Outdated
@0xnmn 0xnmn force-pushed the naman/saved-searches branch from 72eb723 to cbf9ebc Compare January 4, 2023 21:07
@0xnmn 0xnmn requested a review from mrnugget January 4, 2023 21:07
@0xnmn 0xnmn force-pushed the naman/saved-searches branch from cbf9ebc to 25b47e9 Compare January 4, 2023 21:18

@mrnugget mrnugget left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet! Left two comments. One is important: we need to check for both IDs being 0 in the GraphQL layer.

Comment thread cmd/frontend/graphqlbackend/saved_searches.go
Comment thread internal/database/saved_searches.go Outdated

@vdavid vdavid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The VS Code-related changes LGTM!

@0xnmn 0xnmn merged commit 202a984 into main Jan 5, 2023
@0xnmn 0xnmn deleted the naman/saved-searches branch January 5, 2023 15:41
Comment on lines +8375 to +8395
"""
Pagination information.
"""
type ConnectionPageInfo {
"""
When paginating forwards, the cursor to continue.
"""
endCursor: String
"""
When paginating forwards, are there more items?
"""
hasNextPage: Boolean!
"""
When paginating backward, the cursor to continue.
"""
startCursor: String
"""
When paginating backward, are there more items?
"""
hasPreviousPage: Boolean!
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not use BidirectionalPageInfo instead of defining this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, good point. @thenamankumar I think you can remov eyour ConnectionPageInfo and use BidirectionalPageInfo. Turns out we did have this before 😄 https://github.com/sourcegraph/sourcegraph/pull/45705#discussion_r1060451851

fkling added a commit that referenced this pull request Feb 23, 2023
This flag had been removed in #46045 but (accidentally?) added
back in #45705. The feature (search stats) itself been removed in
 #45996. Documentation about it has already been removed in #30564. The
link removed in this PR has been dead since then.
fkling added a commit that referenced this pull request Feb 24, 2023
This flag had been removed in #46045 but (accidentally?) added back in
#45705. The feature (search stats) itself been removed in #45996.
Documentation about it has already been removed in #30564. The link
removed in this PR has been dead since then.

## Test plan

`grep`ped the code for references to the flag and used sourcegraph to
find the commits that made changes to the related code and
documentation.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination - organisation: saved searches - must have - FE scale audit - strategic readiness

7 participants