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

Code Insights: Implement new "Add or remove insights" view #46538

Merged
vovakulikov merged 14 commits into
mainfrom
vk/add-new-add-insight-ui
Jan 18, 2023
Merged

Code Insights: Implement new "Add or remove insights" view #46538
vovakulikov merged 14 commits into
mainfrom
vk/add-new-add-insight-ui

Conversation

@vovakulikov

@vovakulikov vovakulikov commented Jan 16, 2023

Copy link
Copy Markdown
Contributor

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

This PR adds new add or remove insights UI. The new UI has

  • New visual styles. We use more available space on the screen that show more data at once. It became more closer to other similar views (like Fuzzy Finder UI)
  • Fully keyboard accessible UI. Prior to this PR the old view didn't have any keyboard navigation short cuts. Thanks to https://github.com/sourcegraph/sourcegraph/pull/46362 MultiCombobox UI we do have now a full fledged keyboard navigation.
  • Performance improvements First of all there is no loading state anymore. We read all needed data from the cache without unnecessary requests at the beginning. The new view supports smart pagination + search over insights by its title and series label.
Before After
Screenshot 2023-01-16 at 18 37 32 Screenshot 2023-01-16 at 18 37 12

Test plan

  • Go to the dashboard and click add or remove insights button
  • Add and remove some insights with new UI
  • Click save and check that all insights that you remove have been removed and all that you added have been added to the dashboard.

App preview:

Check out the client app preview documentation to learn more.

@github-actions

Copy link
Copy Markdown
Contributor

Problem: the label i-acknowledge-this-goes-into-the-release is absent.
👉 What to do: we're in the next Sourcegraph release code freeze period. If you are 100% sure your changes should get released or provide no risk to the release, add the label your PR with i-acknowledge-this-goes-into-the-release.

@sourcegraph-bot

sourcegraph-bot commented Jan 16, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 175655d...c52e9e1.

No notifications.

@sourcegraph-bot

sourcegraph-bot commented Jan 16, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in OWNERS files for diff 175655d...c52e9e1.

Notify File(s)
@sourcegraph/code-exploration-devs client/wildcard/src/components/Combobox/MultiCombobox.tsx

@sg-e2e-regression-test-bob

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

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.07% (+9.95 kb) 🔺 0.09% (+9.95 kb) 🔺 0.00% (0)

Look at the Statoscope report for a full comparison between the commits c52e9e1 and 175655d 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

@leonore leonore 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.

just passing by as a code insights contributor- this looks great!

Comment thread CHANGELOG.md Outdated
Comment thread enterprise/internal/insights/resolvers/insight_view_resolvers.go Outdated

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.

for any curious passerby, this made me check whether we allow duplicates in the repo UI, which we do, but we must deduplicate somewhere because we still only count results for 1 repos (https://sourcegraph.sourcegraph.com/insights/aW5zaWdodF92aWV3OiIyS1MwRHgxaFJQVVVpWlV5dlh0R2h3WERYSjAi)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@leonore prior to this PR we used deprecated repositoryScope query in each data series definition, but since all series share the same set of repositories we moved this query on the top level and there is no more need to do a uniq filtering here.

If customers somehow end up with repositories duplicates I think we should dedupe them on the backend

@vovakulikov vovakulikov force-pushed the vk/add-new-add-insight-ui branch from 2ed1aa6 to b96fdce Compare January 18, 2023 00:25

@valerybugakov valerybugakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Tested locally and left a couple of optional comments.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this related to CSS order in production issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah (I've had this PR before we added :where to the card styles), I think we can remove it, right?

Comment on lines 85 to 86

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Curious, if we still need this eslint rule at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we can drop this. will do it in a separate PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does that mean that the items array is updated on every render, which causes setSuggestOptions(items) inside of the MultiComboboxList, which might cause a lot of rerenders since it updates the top level object? (might not a be a problem, just double-checking)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean here but I think this is safe because

  • In this particular example there is only one moment when we don't have connection object and fallback on empty (first time list loading phase)
  • Even if we call useLayout every time in the MultiCombobox implementation I used mutable ref variable as a store so no additional react call will be triggered

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a binding between this fragment and the query it assumes already fetched these fields? I wanted to find a query where this fragment is used to understand how it relates to the API request sent to the server.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there is no strict binding, I mean we don't use this particular fragment anywhere else but here, it does rely on the cache data, we assume that at the moment when we open this modal we already loaded information about the currently opened dashboard. I added a comment about this and linked the original query on which we rely here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interesting stuff! We recently discussed with @philipp-spiess how viable it would be to use usefragment_experimental to bind React components to their data needs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pagination hooks still look scary :)

@vovakulikov vovakulikov force-pushed the vk/add-new-add-insight-ui branch from 9377176 to 5c081ae Compare January 18, 2023 22:32
@vovakulikov vovakulikov merged commit 5abdf0f into main Jan 18, 2023
@vovakulikov vovakulikov deleted the vk/add-new-add-insight-ui branch January 18, 2023 23:39
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.

Code Insights: [FE audit] Migrate "add or remove insight" view to async search

5 participants