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

refactor(editor): Migrate nodeBase mixin to composable (no-changelog) #9742

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

alexgrozav
Copy link
Contributor

@alexgrozav alexgrozav commented Jun 14, 2024

Summary

Migrates nodeBase mixin to useNodeBase composable.

Related Linear tickets, Github issues, and Community forum posts

N/A

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Jun 14, 2024
@alexgrozav alexgrozav self-assigned this Jun 18, 2024
elsmr
elsmr previously approved these changes Jun 18, 2024
type: Boolean,
},
workflow: {
type: Object as () => Workflow,
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct? should it be PropType<Workflow>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, copy pasted it. Good catch! Fixed.

setForceActions,
};
},
data() {
return {
isResizing: false,
isTouchActive: false,
inputs: [] as Array<ConnectionTypes | INodeInputConfiguration>,
outputs: [] as Array<ConnectionTypes | INodeOutputConfiguration>,
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this overridden by ...nodeBase in setup? (contains inputs/outputs refs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! Removed.

return {
contextMenu,
externalHooks,
nodeHelpers,
pinnedData,
deviceSupport,
...nodeBase,
Copy link
Member

Choose a reason for hiding this comment

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

nit: Would prefer without the spread, but I understand if it's to limit the amount of refactoring in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to undo the change. Refs and typechecks don't play well with options API. 😰

netroy
netroy previously approved these changes Jun 18, 2024
Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

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

besides minor comments, LGTM 🎉

Comment on lines 151 to 177
name: {
type: String,
required: true,
},
instance: {
type: Object as PropType<BrowserJsPlumbInstance>,
required: true,
},
isReadOnly: {
type: Boolean,
},
isActive: {
type: Boolean,
},
hideActions: {
type: Boolean,
},
disableSelecting: {
type: Boolean,
},
showCustomTooltip: {
type: Boolean,
},
workflow: {
type: Object as () => Workflow,
required: true,
},
Copy link
Member

Choose a reason for hiding this comment

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

is there a plan for how we want to tackle this props duplication once we have migrated away from defineComponent ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Props interfaces should work I think.

Comment on lines +302 to +312
mounted() {
// Initialize the node
if (this.data !== null) {
try {
this.addNode(this.data);
} catch (error) {
// This breaks when new nodes are loaded into store but workflow tab is not currently active
// Shouldn't affect anything
}
}
},
Copy link
Member

Choose a reason for hiding this comment

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

same question here about code duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll probably need a composable after we rewrite.

import { isValidNodeConnectionType } from '@/utils/typeGuards';
import { useI18n } from '@/composables/useI18n';

export function useNodeBase({
Copy link
Member

Choose a reason for hiding this comment

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

Would you like to add some tests for this in the same PR? or should we try to do that in a separate PR ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some tests for main functions now

Copy link
Contributor

✅ No visual regressions found.

Copy link

cypress bot commented Jun 18, 2024

3 failed and 4 flaky tests on run #5563 ↗︎

3 392 0 0 Flakiness 4

Details:

🌳 ado-2111 🖥️ browsers:node18.12.0-chrome107 🤖 schedule 🗃️ e2e/*
Project: n8n Commit: 1300377cf2
Status: Failed Duration: 05:43 💡
Started: Jun 18, 2024 2:42 PM Ended: Jun 18, 2024 2:48 PM
Failed  5-ndv.cy.ts • 1 failed test

View Output Video

Test Artifacts
NDV > should show node name and version in settings Screenshots Video
Failed  26-resource-locator.cy.ts • 1 failed test

View Output Video

Test Artifacts
Resource Locator > should show appropriate errors when search filter is required Test Replay Screenshots Video
Failed  43-oauth-flow.cy.ts • 1 failed test

View Output Video

Test Artifacts
Credentials > create and connect with Google OAuth2 Test Replay Screenshots Video
Flakiness  5-ndv.cy.ts • 2 flaky tests

View Output Video

Test Artifacts
NDV > should not retrieve remote options when required params throw errors Screenshots Video
NDV > Stop listening for trigger event from NDV Screenshots Video
Flakiness  10-undo-redo.cy.ts • 2 flaky tests

View Output Video

Test Artifacts
Undo/Redo > should undo/redo adding connected nodes Test Replay Screenshots Video
Undo/Redo > should undo/redo renaming node using NDV Test Replay Screenshots Video

Review all test suite changes for PR #9742 ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@alexgrozav alexgrozav dismissed stale reviews from netroy and elsmr via a4a3562 June 18, 2024 12:10
@alexgrozav alexgrozav requested a review from netroy June 18, 2024 13:11
Copy link
Contributor

✅ All Cypress E2E specs passed

@alexgrozav alexgrozav merged commit b0d7cfa into master Jun 18, 2024
28 checks passed
@alexgrozav alexgrozav deleted the migrate-nodebase-to-composable branch June 18, 2024 13:35
@janober
Copy link
Member

janober commented Jun 20, 2024

Got released with [email protected]

1 similar comment
@janober
Copy link
Member

janober commented Jun 20, 2024

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants