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

chore(no-code experiments): refactor toolbar (1) #28206

Merged
merged 7 commits into from
Feb 4, 2025

Conversation

jurajmajerik
Copy link
Contributor

Problem

First pass at refactoring Toolbar for no-code experiments. Here's the full list of things to do which I'll be adding to.

Changes

  • Only allow users to modify either textContent or innerHTML, but not both, since they can override each other. Currently, innerHTML updates last in posthog-js, so it "wins."
Before After
image image
  • Form values are now updated properly using Kea reducers instead of direct modification.
  • Fixed some type issues.

How did you test this code?

Manually.

@jurajmajerik jurajmajerik requested a review from a team February 3, 2025 14:23
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR implements the first phase of refactoring the no-code experiments toolbar, focusing on improving content editing and state management.

  • Enforces mutually exclusive text/HTML editing in WebExperimentTransformField.tsx to prevent content override conflicts
  • Added proper state tracking via original_html_state in WebExperimentForm for undo functionality
  • Improved state management using Kea reducers instead of direct mutations in experimentsTabLogic.tsx
  • Updated type definitions to make variants required and conditions optional in types.ts
  • Potential issue: addNewElement still initializes both text and html properties which contradicts single-mode editing

4 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Feb 3, 2025

Size Change: +271 B (+0.02%)

Total Size: 1.17 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.17 MB +271 B (+0.02%)

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 1)
  • 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

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

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • 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 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@jurajmajerik jurajmajerik merged commit 9b2af83 into master Feb 4, 2025
99 checks passed
@jurajmajerik jurajmajerik deleted the no-code-refactor-1 branch February 4, 2025 19:49
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