Repository: PostHog/posthog
Pull request: fix: early access management cancel button
## Problem
Fixes: #17841 

## Changes

- ![image](https://github.com/PostHog/posthog/assets/121796315/18250217-05c1-4104-9000-1c2a1499cae7)

- Also, fixed "cancel" button behaviour while creating and editing early access feature



## How did you test this code?
Locally in my browser


Problem statement:
Early Access Management issues
## Bug description

1. Early access management says its in beta on the page but not the sidebar (I get that there probably isn't room).
2. It is slightly jarring for the button to be "New public beta" as there is no mention of beta elsewhere
3. The empty state button is "Create feature" which it is inconsistent with the public beta button (but I think it's better).

Hints from issue discussion:
I'd like to work on this. If I understand this correctly, I guess you want that "New public beta" to be same as "Create feature" or the other way around? Also, I observed that "cancel" button isn't working on "New Feature Release" page and I guess we can add that too to this issue.
correct, 'create feature' is good 👍

Commit message: fix: early access management cancel button behaviour

Patch to review:
diff --git a/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx b/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx
index 2677d3fb1ccec..0ca03ff0a49a9 100644
--- a/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx
+++ b/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx
@@ -48,8 +48,13 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
         isEditingFeature,
         earlyAccessFeatureMissing,
     } = useValues(earlyAccessFeatureLogic)
-    const { submitEarlyAccessFeatureRequest, cancel, editFeature, updateStage, deleteEarlyAccessFeature } =
-        useActions(earlyAccessFeatureLogic)
+    const {
+        submitEarlyAccessFeatureRequest,
+        loadEarlyAccessFeature,
+        editFeature,
+        updateStage,
+        deleteEarlyAccessFeature,
+    } = useActions(earlyAccessFeatureLogic)
 
     const isNewEarlyAccessFeature = id === 'new' || id === undefined
 
@@ -72,7 +77,14 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
                             <>
                                 <LemonButton
                                     type="secondary"
-                                    onClick={() => cancel()}
+                                    onClick={() => {
+                                        if (isEditingFeature) {
+                                            editFeature(false)
+                                            loadEarlyAccessFeature()
+                                        } else {
+                                            router.actions.push(urls.earlyAccessFeatures())
+                                        }
+                                    }}
                                     disabledReason={isEarlyAccessFeatureSubmitting ? 'Saving…' : undefined}
                                 >
                                     Cancel
diff --git a/frontend/src/scenes/early-access-features/EarlyAccessFeatures.tsx b/frontend/src/scenes/early-access-features/EarlyAccessFeatures.tsx
index c6dc0c2c83cf0..594a986400042 100644
--- a/frontend/src/scenes/early-access-features/EarlyAccessFeatures.tsx
+++ b/frontend/src/scenes/early-access-features/EarlyAccessFeatures.tsx
@@ -60,7 +60,7 @@ export function EarlyAccessFeatures(): JSX.Element {
                 }
                 buttons={
                     <LemonButton type="primary" to={urls.earlyAccessFeature('new')}>
-                        New public beta
+                        Create feature
                     </LemonButton>
                 }
                 delimited


Code review comments:
diff_hunk: @@ -72,7 +77,14 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
                             <>
                                 <LemonButton
                                     type="secondary"
-                                    onClick={() => cancel()}
+                                    onClick={() => {
path: frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx
text: @user1:
You can get rid of the cancel action and listener now