Skip to content

chore: simplify workspace routing #17981

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
merged 5 commits into from
May 27, 2025
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

No description provided.

@BrunoQuaresma BrunoQuaresma requested a review from a team May 21, 2025 23:10
@BrunoQuaresma BrunoQuaresma self-assigned this May 21, 2025
@BrunoQuaresma BrunoQuaresma requested review from Kira-Pilot, a team and aslilac and removed request for a team and Kira-Pilot May 21, 2025 23:10
Comment on lines 23 to 30
const [visible, setVisible] = useState(true);

useEffect(() => {
const isHidden = HIDE_DEPLOYMENT_BANNER_PATHS.some((regex) =>
regex.test(location.pathname),
);
setVisible(!isHidden);
}, [location.pathname]);
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't need to be an effect, you're pulling state from a hook. just use a const.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

100%!!! Idk why I did that 🤦

@BrunoQuaresma BrunoQuaresma requested a review from aslilac May 22, 2025 23:45
@@ -10,7 +10,7 @@ import { useAgentLogs } from "./useAgentLogs";
* Issue: https://github.com/romgain/jest-websocket-mock/issues/172
*/

describe("useAgentLogs", () => {
describe.skip("useAgentLogs", () => {
Copy link
Member

Choose a reason for hiding this comment

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

Just got the go-ahead to work on fixing this flake today!

Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

Changes mostly look fine to me. The main thing I'm worried about is the regex, but if you think it's fine, I can go ahead and approve

flexDirection: "column",
}}
>
<div className="flex flex-col flex-1">
Copy link
Member

Choose a reason for hiding this comment

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

I'm worried that we missed something in the conversion here:

  • The old version didn't treat this div as a flex item itself. It just defined how the item grows in the parent flex container
  • We didn't add any padding, when the old version of the element had it

Was that intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeap. I did some storybook reviews and QA around and I didn't find anything broken. Maybe it was a leftover? I would appreciate you helping me with some QA 🙏

Comment on lines 10 to 12
// Workspace page.
// Hide the banner on workspace page because it already has a lot of information.
/^\/@[^\/]+\/[^\/]+$/,
Copy link
Member

Choose a reason for hiding this comment

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

What types of paths are we trying to catch with this? My gut feeling is that the current regex might be a little too loose in some ways, and a little too strict in others

Like, right now, we're exclusively matching patterns that go like /@something/something-else, but we'll never match anything like /@something/something-else/a-third-segment, because the regex only supports two segments. On the other hand, we're letting the regex accept characters that aren't valid in a URL

Copy link
Member

@Parkreiner Parkreiner May 23, 2025

Choose a reason for hiding this comment

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

If this wasn't what you wanted, you can let me know what you were going for, and I can try to whip up a regex for it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is exactly what we want. It is to catch the workspace page route, but I'm open in case you have a better regex idea or a way to match the path. Since the route path def is /:username/:workspace it was not working well with the react-router-dom path matching utility.

Copy link
Member

@Parkreiner Parkreiner May 23, 2025

Choose a reason for hiding this comment

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

In that case, try ^\/@(?<username>[a-zA-Z0-9-]+)\/(?<workspace_name>[a-zA-Z0-9-]+)$

  • It adds names to the main groups that we're checking for, so it'll be a little more self-documenting
  • It redefines each group to only allow the characters A-Z (lowercase or uppercase), numbers, and hyphens

I just checked what characters we allow for usernames and workspace names, and those seemed to be the only characters we support right now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a good one 👍

@BrunoQuaresma BrunoQuaresma requested a review from Parkreiner May 24, 2025 14:36
Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

Should be good to go 👌

@BrunoQuaresma BrunoQuaresma merged commit 5b90c69 into main May 27, 2025
33 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/refactor-full-screen-layout branch May 27, 2025 14:05
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants