10000 feat(messaging): start using Hogflow inputs in workflow editor by havenbarnes · Pull Request #33678 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(messaging): start using Hogflow inputs in workflow editor #33678

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

Open
wants to merge 195 commits into
base: master
Choose a base branch
from

Conversation

havenbarnes
10000 Copy link
Contributor

Important

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Problem

Changes

Did you write or update any docs for this change?

How did you test this code?

havenbarnes and others added 30 commits May 6, 2025 18:31
Base automatically changed from hogfunctioninputs-hogflows-refactor to master June 17, 2025 10:52
@@ -1,6 +1,7 @@
import { Edge, getSmoothStepPath, Handle, Node, Position, XYPosition } from '@xyflow/react'
import { NEW_TEMPLATE } from 'products/messaging/frontend/TemplateLibrary/constants'
Copy link
Contributor Author
@havenbarnes havenbarnes Jun 17, 2025

Choose a reason for hiding this comment

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

This whole file needs a fresh coat of paint, will be refactoring in a follow-up PR to make this a bit more organized and less of a pile of export functions

@havenbarnes havenbarnes marked this pull request as ready for review June 17, 2025 18:01
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

Major refactor of the messaging workflow editor to use Hogflow inputs system, replacing the previous basic input implementation with a more robust configuration framework.

  • Introduced products/messaging/frontend/Campaigns/Workflows/Nodes/NodeDetailsPanel.tsx replacing StepDetails.tsx, providing enhanced node configuration with CyclotronJobInputs integration
  • Restructured node data model in products/messaging/frontend/Campaigns/Workflows/types.ts by moving inputs into a config object and simplifying the CyclotronJob input schema
  • Added products/messaging/frontend/Campaigns/Workflows/Nodes/nodeLogic.ts implementing Kea form logic for handling node inputs
  • Improved campaign integration in products/messaging/frontend/Campaigns/campaignLogic.ts with proper API handling using api.hogFlows
  • Added type-specific input schemas in products/messaging/frontend/Campaigns/Workflows/Nodes/utils.ts for different node types (message, delay, conditional_branch)

15 files reviewed, 4 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +17 to 29
const NEW_CAMPAIGN: HogFlow = {
id: 'new',
name: 'Untitled campaign',
name: '',
edges: [],
actions: [],
trigger: { type: 'event' },
trigger_masking: { ttl: 0, hash: '', threshold: 0 },
conversion: { window_minutes: 0, filters: [] },
exit_condition: 'exit_on_conversion',
exit_condition: 'exit_only_at_end',
version: 1,
status: 'draft',
team_id: 0,
team_id: -1,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider defining these default values in a constants file for better maintainability and reuse across components

router.actions.replace(
urls.messagingCampaign(campaign.id, campaignSceneLogic.findMounted()?.values.currentTab)
)
actions.resetCampaign(campaign)
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: resetCampaign action is used but not defined in the actions block

Comment on lines +231 to +235
type: 'string',
key: 'duration',
label: 'Duration (minutes)',
required: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Duration is defined as type 'string' but the default value in getNodeInputs is a number (15). This type mismatch could cause runtime issues.

Suggested change
type: 'string',
key: 'duration',
label: 'Duration (minutes)',
required: true,
},
{
type: 'number',
key: 'duration',
label: 'Duration (minutes)',
required: true,
},

Comment on lines +26 to +33
const canBeDeleted = (): boolean => {
const outgoingNodes = getOutgoers(node, nodes, edges)
if (outgoingNodes.length === 1) {
return true
}

return new Set(outgoingNodes.map((node) => node.id)).size === 1
}
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: the canBeDeleted logic appears to have an edge case - it returns true if there's 1 outgoing node OR if all outgoing nodes have the same ID, which seems contradictory to the warning about cleaning up branching steps

inputs: node.data.config.inputs,
inputs_schema: getNodeInputsSchema(node.data),
}}
setConfigurationValue={handleInputChange}
Copy link
Contributor

Choose a reason for hiding this comment

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

The CyclotronJobInputs component expects an onInputChange prop, not setConfigurationValue. This prop name mismatch will prevent the inputs from updating correctly. Please change:

setConfigurationValue={handleInputChange}

to:

onInputChange={handleInputChange}
Suggested change
setConfigurationValue={handleInputChange}
onInputChange={handleInputChange}

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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.

4 participants
0