mirror of
https://github.com/OFFIS-ESC/constellation-analyzer
synced 2026-01-26 23:43:40 +00:00
Omit handle fields from serialization entirely
Since edges use floating calculations that ignore handle positions, the handle IDs (like 'top-source', 'right-target') should never be persisted. They're only used to define clickable areas for connections. This ensures consistency: both migrated old edges and newly created edges will have no handle fields in saved JSON files. Addresses PR review comment about serialization inconsistency. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4b865762a1
commit
93a5f38112
1 changed files with 4 additions and 11 deletions
|
|
@ -226,23 +226,16 @@ export function serializeActors(actors: Actor[]): SerializedActor[] {
|
|||
*/
|
||||
export function serializeRelations(relations: Relation[]): SerializedRelation[] {
|
||||
return relations.map(relation => {
|
||||
const serialized: SerializedRelation = {
|
||||
// Omit handle fields entirely - edges use floating calculations
|
||||
// The handle IDs (like "top-source", "right-target") are only for defining
|
||||
// clickable areas and should not be persisted
|
||||
return {
|
||||
id: relation.id,
|
||||
source: relation.source,
|
||||
target: relation.target,
|
||||
type: relation.type,
|
||||
data: relation.data,
|
||||
};
|
||||
|
||||
// Only include handles if they exist and are non-null/non-undefined
|
||||
if (relation.sourceHandle != null) {
|
||||
serialized.sourceHandle = relation.sourceHandle;
|
||||
}
|
||||
if (relation.targetHandle != null) {
|
||||
serialized.targetHandle = relation.targetHandle;
|
||||
}
|
||||
|
||||
return serialized;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue