Svelte: Implement and instantiate FilePopover#62498
Conversation
b95b8d0 to
73a02dd
Compare
camdencheek
left a comment
There was a problem hiding this comment.
A couple of general comments about the design we should follow up on.
The top line is almost always going to get cut off because we're trying to fit a full repo name and a large path into a small space:
Long commit summaries should be wrapped, not truncated. And we should linkify the PR number.
The radius of the popover background does not match the border radius of its border.
There was a problem hiding this comment.
Viewing this in storybook fails for me with can't access property "split", filePath2 is undefined
@camdencheek Do we actually need the repository name? I feel like the file path should suffice, since by the time the user gets to a file tree view, they'll more than likely know what repo they're in. Right? |
73a02dd to
de4ab15
Compare
This was part of the original design. I have to say, I like it better in dark mode. It does look a little awkward in light mode. |
1e6174b to
d14df94
Compare
There was a problem hiding this comment.
Why did this change? Other components may be depending on being able to set --popover-border-radius
There was a problem hiding this comment.
There are two values. --popover-border-radius (equal to 5px) and --border-radius (equal to 3px).
There was a problem hiding this comment.
Right, why did you change the Popover component to use --border-radius?
There was a problem hiding this comment.
ahhh... I see what you're saying. I'll change it.
There was a problem hiding this comment.
Why did we depart from the pattern established for RepoPopover and do the data fetching in the component rather than in the +page.ts?
There was a problem hiding this comment.
@camdencheek Long story short, I tried to implement it around 3 or 4 times and it was a giant pain each time, always with many bugs to work through. Why does it matter if we do it here? It seems to be better here because it's contained directly in the component that calls it. It also only mounts on hover, so we're only calling it when we need it.
There was a problem hiding this comment.
In general, we want to separate data fetching from rendering because the source of the data might be different when we use the component in different places. e.g., we may want to batch these calls, or cancel a call if you hover over something different, or preload the data for some locations.
Another more concrete reason is that this is now much harder to test because, rather than just passing in the data it needs to render, you now need to mock out the API call.
There was a problem hiding this comment.
Another concrete example is, if you re-hover, we now re-fetch because the component is re-created.
There was a problem hiding this comment.
Okay. I see.
There was a problem hiding this comment.
In that case, with the little time I have left, I think I need to cry "uncle" here and pass this along to someone else. I don't see me getting this done today. I've tried a number of times and failed to reproduce what we did with RepoPopover.
d14df94 to
dcf1465
Compare
|
With @jasonhawkharris on leave, any chance this gets merged anytime soon? @camdencheek |
|
Yep, this is first on my list tomorrow |
f9423a3 to
f2a3f88
Compare
d967621 to
30706d8
Compare
|
@camdencheek @jasonhawkharris As a follow up to this:
|
This PR Implements and instantiates the file popover on the SvelteKit web app.
Dark Mode:
https://github.com/sourcegraph/sourcegraph/assets/62355966/f1405cc2-54e0-49ba-aa26-7ddf2d258970
Light Mode:
https://github.com/sourcegraph/sourcegraph/assets/62355966/a8eb53ed-2a38-4574-a76a-5f5559ded015
Questions:
Test plan
Added a storybook test and a playwright test