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): Enable collaboration features only in NodeView v2 (no-changelog) #10756

Merged
merged 7 commits into from
Sep 11, 2024

Conversation

netroy
Copy link
Member

@netroy netroy commented Sep 10, 2024

Summary

collaboration features aren't working on NodeView v1 as expected. Instead of trying to fix it, in this PR, we disable these features altogether for v1.

Review / Merge checklist

  • PR title and summary are descriptive
  • Tests included

@netroy netroy requested a review from tomi September 10, 2024 11:56
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Sep 10, 2024
tomi
tomi previously approved these changes Sep 10, 2024
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Copy link

cypress bot commented Sep 10, 2024

n8n    Run #6833

Run Properties:  status check passed Passed #6833  •  git commit eb87ad9ed1: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project n8n
Branch Review remove-collaboration-from-v1-nodeview
Run status status check passed Passed #6833
Run duration 04m 43s
Commit git commit eb87ad9ed1: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Committer कारतोफ्फेलस्क्रिप्ट™
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 427
View all changes introduced in this branch ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy force-pushed the remove-collaboration-from-v1-nodeview branch from b249fa4 to acdc168 Compare September 10, 2024 14:20
@netroy netroy force-pushed the remove-collaboration-from-v1-nodeview branch from acdc168 to 5b4ba90 Compare September 10, 2024 15:17
@MiloradFilipovic MiloradFilipovic self-requested a review September 11, 2024 07:03
Copy link
Contributor

@MiloradFilipovic MiloradFilipovic left a comment

Choose a reason for hiding this comment

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

Code looks good. It's much cleaner this way.
But looks like the notifyWorkflowClosed is not fired properly when tab is closed (or on reload):

Screen.Recording.2024-09-11.at.09.16.43.mov

Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

Works really nicely now, and it's better structured 👍 Couple comments / questions

const msgData: IActiveWorkflowUsersChanged = {
const users = await this.userRepository.getByIds(this.userRepository.manager, userIds);
const activeCollaborators = users.map((user) => ({
user: user.toIUser(),
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between IUser and Public user? Which one should be used going forward?

Copy link
Member Author

Choose a reason for hiding this comment

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

IUser is the just id, email, firstName, and lastName. We should be returning that to the frontend everywhere, unless any other field is explicitly needed.
PublicUser was originally meant to be this, but has now instead become too loaded, and leaks too much data about other users.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could mark it as @deprecated

packages/cli/src/databases/entities/user.ts Show resolved Hide resolved
@@ -17,42 +15,40 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
export function useBeforeUnload({ route }: { route: ReturnType<typeof useRoute> }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would actually make more sense to rename this into useCanvasBeforeUnload since this contains business logic and split out a generic useBeforeUnload into a separate composable. No need to do here, I can also do it as a follow up.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is mostly generic now, and can be used by other views as well.
We do have uiStore.stateIsDirty that's currently only used in canvas. but we could reuse that to mark when any view has unsaved changes.


const heartbeatTimer = ref<number | null>(null);

const startHeartbeat = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea to bring this into this store 👍

packages/editor-ui/src/stores/collaboration.store.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/stores/collaboration.store.ts Outdated Show resolved Hide resolved
return;
notifyWorkflowClosed();
stopHeartbeat();
pushStore.clearQueue();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if clearing the queue should be collaborationStores responsibility, as the queue should be private implementation detail of pushStore. Sure it works now, as this is the only one sending messages, but in a general case there could be items from other producers.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we need to move the queue in this store. but I'd like to do that refactor in another PR.

@netroy netroy requested a review from tomi September 11, 2024 12:07
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this ❤️ 🚀

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy merged commit a1e011d into master Sep 11, 2024
43 of 61 checks passed
@netroy netroy deleted the remove-collaboration-from-v1-nodeview branch September 11, 2024 12:22
@Joffcom
Copy link
Member

Joffcom commented Sep 11, 2024

Got released with [email protected]

MiloradFilipovic added a commit that referenced this pull request Sep 12, 2024
* master:
  refactor(core): Revamp subworkflow policy checker errors (#10752)
  ci(benchmark): Add missing license cert (#10773)
  feat(editor): Show Collaboration pane only when there are multiple active users (#10772)
  🚀 Release 1.59.0 (#10775)
  feat: Add credential help to Assistant (no-changelog) (#10736)
  fix(editor): Fix error rendering and indexing of LLM sub-node outputs (#10688)
  feat(OpenAI Node): Add Max Tools Iteration parameter and prevent tool calling after execution is aborted (#10735)
  fix(editor): Revert remove tooltip from info tip (no-changelog) (#10771)
  refactor(editor): Enable collaboration features only in NodeView v2 (no-changelog) (#10756)
  fix(If Node): Update copy for type conversion parameter (#10769)
  build(core): Allow adding tests side by side with the code (#10760)

# Conflicts:
#	packages/editor-ui/src/stores/assistant.store.ts
riascho pushed a commit that referenced this pull request Sep 23, 2024
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 Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants