Skip to content

collaborative-editing does not connect to /websocket if not enabled globally #246

@wuservices

Description

@wuservices

Extension

Collaborative Editing

Describe the Bug

If you disable collaborative editing globally, it doesn't work at all, even after manually adding the necessary interface.

Scenario

  1. Collaborative editing module enabled
  2. Enable Globally setting for collaborative editing is disabled
  3. Collaboration interface added for a collection manually

Symptoms

  • Opening two editors doesn't show any collaboration avatar or synced changes on a given field
  • There's no connection to /websocket when viewing Network tools in the browser

Potential issue

I'm still pretty new to Directus, but it seems like we'd expect the Interface to connect to realtime (/websocket). In this code, it seems like it only connects if enabled globally:

const realtimeEnabled = computed(() => {
const moduleEnabled = (settingsStore.settings as Settings)?.module_bar.find(
(module) => module.type === 'module' && module.id === MODULE_ID,
)?.enabled;
const enabledGlobally = settings.value?.enabled_globally;
return moduleEnabled && enabledGlobally;

If you follow that usage, provider.connect() is skipped, and that seems like it's what eventually would have connected to the websocket.

Not sure if there are any other issues, but we at least know for sure if there's no connection, it can't work.

To Reproduce

Confirm it works globally

  1. Install @directus-labs/[email protected]
  2. Enable the module
  3. Go to /admin/collaborative-editing and confirm it's enabled globally
  4. Go to an edit page, and confirm there's a request to /websocket

Disable globally, and enable selectively

  1. Go to /admin/collaborative-editing, uncheck Enabled, Save
  2. Go to /admin/settings/data-model, click on any model, Create Field, choose Collaboration, Save
  3. Go to an edit page for that model and there will be no /websocket request

Directus Version

11.12.0

Hosting Strategy

Self-Hosted (Docker Image)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions