-
Notifications
You must be signed in to change notification settings - Fork 228
feat(COMPASS-9432): apply initial layout #7047
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
base: main
Are you sure you want to change the base?
Conversation
783340f
to
710bb2e
Compare
The layouts work much better now with the dimensions fixed 🎉. But still not exactly as imagined. For example the screenshot is LEFT_RIGHT - I thought this would spread to more columns. STAR creates one column only. Are we doing something wrong or is this expected result? @lchans |
9f586d2
to
11bfe02
Compare
036be24
to
a4d96d8
Compare
expect(store.getState().diagram?.edits.current).to.have.lengthOf(1); | ||
}); | ||
const renderResult = renderWithConnections( | ||
<Provider store={store}>{component}</Provider>, |
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.
We have helpers for this in compass-testing-library, I strongly suggest you take a look at those. We added these specifically so that we don't need to spend time for similar setup all the time and so that making changes to the plugin internals is easier in the long run (otherwise every time we tinker with plugin system ALL tests might need to be updated accordingly). If those doesn't cover some case you are trying to cover here, please shout this out so that we can provide tools covering those and keep the benefits of a shared testing harness
@mabaasit FYI as you added some helpers here initially.
void applyInitialLayout(storedNodes); | ||
return; | ||
} | ||
setNodes(storedNodes); |
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.
The state itself is not an effect here, this is state derived from model, only applying initial layout is an effect
packages/compass-data-modeling/src/components/diagram-editor.tsx
Outdated
Show resolved
Hide resolved
console.error('Error applying layout:', err); | ||
} | ||
}, | ||
[setNodes] |
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.
Missing dependencies
void applyInitialLayout(storedNodes); | ||
return; | ||
} | ||
setNodes(storedNodes); | ||
}, [model?.collections]); |
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.
Missing dependencies
'LEFT_RIGHT' | ||
); | ||
setNodes(positionedNodes); | ||
onApplyInitialLayout( |
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.
We are supposed to also fit diagram into view after initial layout gets applied, right? I'm not seeing this happening at the moment
Description
[-1, -1]
applyLayout
from the diagramming lib to position the nodesChecklist
Motivation and Context
Open Questions
Dependents
Types of changes