-
Notifications
You must be signed in to change notification settings - Fork 27
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
refactor(20321): Refactoring the policy loading #385
Conversation
8cec8c9
to
cb7173c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a couple of as NodeAddChange
and as Connection
statements. This is an unsafe way of casting to an object. If this happens to variable declaration or return types you can use satisfies NodeAddChange
instead. For return types you could also declare the return type of the function and remove the casting
// example
export const loadBehaviorPolicy = (behaviorPolicy: BehaviorPolicy): NodeAddChange => {
// ... stuff
return { item: behaviorPolicyNode, type: 'add' }
}
export const loadClientFilter = (behaviorPolicy: BehaviorPolicy, behaviorPolicyNode: Node<BehaviorPolicyData>): (NodeAddChange | Connection)[] => {
/// ..stuff
return [
{ item: topicNode, type: 'add' },
{ source: topicNode.id, target: behaviorPolicyNode.id, sourceHandle: null, targetHandle: null },
]
}
cf14897
to
4feba71
Compare
) | ||
|
||
store.onNodesChange(nodeChanges) | ||
edgeConnects.map((connection) => store.onConnect(connection)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a map, i dont see anyone collecting it
c66d871
to
ff209dd
Compare
See https://hivemq.kanbanize.com/ctrl_board/57/cards/20321/details/
The PR refactors how the policy payload is transformed into a designer graph.
The previous process was creating the graph elements (nodes and edges) from the payload and inserting them iteratively into the Design store. This created a re-render race condition, with parent nodes not yet inserted into the graph when their connecting edges were added. The error message at the first loading was the visual result of the faulty operation.
The new process iteratively creates ALL the graph elements BEFORE inserting them in two distinct operations: nodes first then edges.
The PR also fixes a bug with the behaviour policy, in which pipelines were connected to every transition created, regardless of the real dependency.
Before
After