Extract Vue.observable state from constants to prevent Vue 3 duplication

What does this MR do and why?

Moves Vue.observable reactive state (portalState, sidebarState, duoChatGlobalState) from constants.js to a dedicated state.js file in the super_sidebar directory.

This change is needed to enable Vue 3 compatibility. When these reactive state objects are imported from a Vue 3 dependency tree, they get wrongly duplicated, causing state to be out of sync across the application. By extracting them into a separate file and adding it to the INFECTION_BLOCKLIST in context_aliases_shared.js, we ensure a single instance is shared.

This also improves code organization: Vue.observable objects are mutable reactive state, not constants, and should not live in a constants file.

Changes

  • New file: app/assets/javascripts/super_sidebar/state.js containing all Vue.observable state objects
  • Updated: constants.js to remove reactive state (keeps only true constants)
  • Updated: config/helpers/context_aliases_shared.js to add state.js to the INFECTION_BLOCKLIST
  • Updated: All imports across components, utilities, specs, and documentation to reference state.js
  • Removed: Unnecessary jest.mock('~/super_sidebar/constants') in new_namespace_page_spec.js

Merge request reports

Loading