Skip to content
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

refactor(protocol-designer): remove basename from router #16258

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions protocol-designer/src/ProtocolEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,22 @@ import { Bouncing } from './Bouncing'
import styles from './components/ProtocolEditor.module.css'
import './css/reset.module.css'

import type { BrowserRouterProps } from 'react-router-dom'

const showGateModal =
process.env.NODE_ENV === 'production' || process.env.OT_PD_SHOW_GATE

// sandbox urls get deployed to subdirectories in sandbox.designer.opentrons.com/${subFolder}
// prod urls get deployed to designer.opentrons.com with no subdir, so we don't need to add a base name
const routerBaseName =
process.env.NODE_ENV === 'production'
? null
: `/${window.location.pathname.split('/')[1]}`

function ProtocolEditorComponent(): JSX.Element {
const flags = useSelector(getFeatureFlagData)
const enableRedesign = useSelector(getEnableRedesign)

const prereleaseModeEnabled = flags.PRERELEASE_MODE === true

const browserRouterProps: BrowserRouterProps =
routerBaseName != null ? { basename: routerBaseName } : {}

return (
<div id="protocol-editor">
<TopPortalRoot />
{enableRedesign ? (
<Flex flexDirection={DIRECTION_COLUMN}>
{prereleaseModeEnabled ? <Bouncing /> : null}
<HashRouter {...browserRouterProps}>
<HashRouter>
<ProtocolRoutes />
</HashRouter>
</Flex>
Expand Down
Loading