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

svelte: Preserve current revision in repo search input#62822

Merged
fkling merged 2 commits intomainfrom
fkling/62713-preserve-revision
May 21, 2024
Merged

svelte: Preserve current revision in repo search input#62822
fkling merged 2 commits intomainfrom
fkling/62713-preserve-revision

Conversation

@fkling
Copy link
Contributor

@fkling fkling commented May 21, 2024

Closes #62713

Test plan

Manually tested with default revision, selected branch and selected revision.

@fkling fkling added the team/code-search Issues owned by the code search team label May 21, 2024
@fkling fkling requested a review from a team May 21, 2024 13:42
@fkling fkling self-assigned this May 21, 2024
@cla-bot cla-bot bot added the cla-signed label May 21, 2024
Copy link
Member

@camdencheek camdencheek left a comment

Choose a reason for hiding this comment

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

Tried it out locally, LGTM!

return ''
}

// If the (URL) revision is or starts with the commit ID, use the abbreviated commit ID
Copy link
Member

Choose a reason for hiding this comment

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

Oh, that's a smart way to do it.

Copy link
Contributor Author

@fkling fkling May 21, 2024

Choose a reason for hiding this comment

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

In the React app we only check whether the revision is 40 chars, assume its an commit SHA and abbreviate it. This produces incorrect behavior when there is a branch name with exactly 40 chars. We should fix that... at the same time I wish there was a way to abstract all these details from components. Maybe we should compute the human readable revision in the data loader and simply pass that around.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the computation to the data loader. We are already doing something similar for repo name. https://github.com/sourcegraph/sourcegraph/pull/62822/commits/7497104c39bd238e3160c2c8b1b7a6f57db5a4ca

@fkling fkling merged commit 4bba154 into main May 21, 2024
@fkling fkling deleted the fkling/62713-preserve-revision branch May 21, 2024 15:36
@taiyab
Copy link
Contributor

taiyab commented May 21, 2024

@fkling I think this broke showing suggestions right away as soon as you reveal search via /.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/code-search Issues owned by the code search team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Svelte: preserve repo revision in search bar

3 participants