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

feat(experiments): Add input field for editing selector #26487

Merged
merged 7 commits into from
Nov 30, 2024

Conversation

danielbachhuber
Copy link
Contributor

@danielbachhuber danielbachhuber commented Nov 27, 2024

Changes

Adds an input field for editing the selector associated with a web experiment transform. This lets the user be more specific with the behavior they'd like.

From https://posthoghelp.zendesk.com/agent/tickets/20916

CleanShot 2024-11-27 at 12 59 16

How did you test this code?

I verified I could edit the selector, and that the selector saved as expected and was applied after I refreshed the page.

Copy link
Contributor

github-actions bot commented Nov 27, 2024

Size Change: +402 B (+0.03%)

Total Size: 1.16 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.16 MB +402 B (+0.03%)

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@@ -131,6 +132,12 @@ export const experimentsTabLogic = kea<experimentsTabLogicType>([
hideButtonExperiments: () => false,
},
],
editSelectorShowing: [
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: If we have a state value that's only used locally within a single element, especially a toggle or boolean value, I strongly prefer using local state instead of a Kea value. In WebExperimentTransformField.tsx, we already do this with [transformSelected, setTransformSelected].

While we always aim to separate state from React components, I think this is the one exception. It simplifies working with the value since it only requires a single line of code, and you don't have to update two separate files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, updated in 98d0eec

Copy link
Contributor

@jurajmajerik jurajmajerik left a comment

Choose a reason for hiding this comment

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

Good catch!

@danielbachhuber danielbachhuber merged commit b4d51e3 into master Nov 30, 2024
96 checks passed
@danielbachhuber danielbachhuber deleted the experiments/allow-editing-selector branch November 30, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants