Skip to content

Commit

Permalink
chore: Retire DISABLE_SAVE_AND_RETURN feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Feb 15, 2024
1 parent 35190d9 commit 7e47c79
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 89 deletions.
28 changes: 0 additions & 28 deletions editor.planx.uk/src/@planx/components/Send/Public.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from "axios";
import DelayedLoadingIndicator from "components/DelayedLoadingIndicator";
import { hasFeatureFlag } from "lib/featureFlags";
import { useStore } from "pages/FlowEditor/lib/store";
import React, { useEffect } from "react";
import { useAsync } from "react-use";
Expand All @@ -20,33 +19,6 @@ export type Props = PublicProps<Send>;
const SendComponent: React.FC<Props> = ({
destinations = [DEFAULT_DESTINATION],
...props
}) => {
// If testing with the feature flag, skip scheduled event creation because no stored lowcal_session to generate payloads
const testSession = hasFeatureFlag("DISABLE_SAVE_AND_RETURN");

useEffect(() => {
if (testSession) {
props.handleSubmit?.({
...makeData(props, true, "skippedEvents"),
auto: true,
});
}
}, []);

if (testSession) {
return (
<Card>
<DelayedLoadingIndicator text={`Skipping test submission...`} />
</Card>
);
} else {
return <SendEvents destinations={destinations} {...props} />;
}
};

const SendEvents: React.FC<Props> = ({
destinations = [DEFAULT_DESTINATION],
...props
}) => {
const [passport, sessionId, teamSlug] = useStore((state) => [
state.computePassport(),
Expand Down
54 changes: 0 additions & 54 deletions editor.planx.uk/src/components/FeatureFlagBanner.tsx

This file was deleted.

6 changes: 1 addition & 5 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import MuiToolbar from "@mui/material/Toolbar";
import Typography from "@mui/material/Typography";
import useMediaQuery from "@mui/material/useMediaQuery";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { hasFeatureFlag } from "lib/featureFlags";
import { clearLocalFlow } from "lib/local";
import { capitalize } from "lodash";
import { Route } from "navi";
Expand All @@ -43,7 +42,6 @@ import { useStore } from "../pages/FlowEditor/lib/store";
import { rootFlowPath, rootTeamPath } from "../routes/utils";
import AnalyticsDisabledBanner from "./AnalyticsDisabledBanner";
import { ConfirmationDialog } from "./ConfirmationDialog";
import FeatureFlagBanner from "./FeatureFlagBanner";
import TestEnvironmentBanner from "./TestEnvironmentBanner";

export const HEADER_HEIGHT = 74;
Expand Down Expand Up @@ -274,8 +272,7 @@ const NavBar: React.FC = () => {
);
const isSaveAndReturnLandingPage =
path !== ApplicationPath.SingleSession &&
!saveToEmail &&
!hasFeatureFlag("DISABLE_SAVE_AND_RETURN");
!saveToEmail;
const isContentPage = useCurrentRoute()?.data?.isContentPage;
const { node } = useAnalyticsTracking();
const isSectionCard = node?.type == TYPES.Section;
Expand Down Expand Up @@ -378,7 +375,6 @@ const PublicToolbar: React.FC<{
<NavBar />
<AnalyticsDisabledBanner />
<TestEnvironmentBanner />
<FeatureFlagBanner />
<ConfirmationDialog
open={isDialogOpen}
onClose={handleRestart}
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/lib/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// add/edit/remove feature flags in array below
const AVAILABLE_FEATURE_FLAGS = ["DISABLE_SAVE_AND_RETURN"] as const;
const AVAILABLE_FEATURE_FLAGS = [] as const;

type FeatureFlag = (typeof AVAILABLE_FEATURE_FLAGS)[number];

Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/routes/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const isSaveReturnFlow = (flowData: Record<string, any>): boolean =>
export const setPath = (flowData: Record<string, any>, req: NaviRequest) => {
// XXX: store.path is SingleSession by default
if (!isSaveReturnFlow(flowData)) return;
if (hasFeatureFlag("DISABLE_SAVE_AND_RETURN")) return;

const isEmailCaptured = Boolean(useStore.getState().saveToEmail);
const path =
req.params.sessionId && !isEmailCaptured
Expand Down

0 comments on commit 7e47c79

Please sign in to comment.