kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Remove Vuex from core framework, make plugins responsible for store creation

Open rtibbles opened this issue 8 months ago • 3 comments

Overview

Complexity: High Target branch: develop

Context

Currently, Vuex is deeply embedded in the core framework:

  • packages/kolibri/store.js creates a shared store singleton and exports it
  • packages/kolibri/index.js calls Vue.use(Vuex) globally
  • packages/kolibri-app/src/index.js (KolibriApp.setupVue()) assembles plugin state into the shared store via hotUpdate(), replaceState(), and registerModule(), then passes the store to new Vue()
  • packages/kolibri/internal/apiSpec.js exposes vuex as part of the public API for third-party plugins
  • packages/kolibri/store.js exports coreStoreFactory used by plugin tests

This means plugins cannot own their stores independently — the framework assumes a single shared store and handles all assembly.

The Change

Move Vuex out of core framework responsibility. Plugins that still need Vuex create and own their own stores.

  • A createStore utility in packages/kolibri-common calls Vue.use(Vuex), creates a store from the plugin module definition, and returns it. Plugins include the store in their RootVue getter, which gets passed through to new Vue() naturally.
  • KolibriApp cleaned up:
    • get store(), get pluginModule(), and setupVue() removed
    • get stateSetters() removed — plugins move async initialization into their root component's setup()
    • startRootVue() no longer passes a store to new Vue() — any store comes through RootVue
  • packages/kolibri/store.js deleted — no more shared singleton
  • Vue.use(Vuex) removed from packages/kolibri/index.js
  • vuex removed from packages/kolibri/package.json dependencies, and apiSpec.js regenerated via linting/formatting
  • coreStoreFactory removed — plugin tests use createStore from kolibri-common or create their own stores directly

Out of Scope

  • Migrating individual plugins off Vuex — this is about removing Vuex from the framework, not from plugin internals

Acceptance Criteria

  • [ ] packages/kolibri/store.js deleted — no shared store singleton
  • [ ] Vue.use(Vuex) removed from packages/kolibri/index.js
  • [ ] vuex removed from packages/kolibri/package.json dependencies, and apiSpec.js regenerated via linting/formatting
  • [ ] coreStoreFactory removed
  • [ ] Core Vuex module (kolibri/core/frontend/state/modules/core/) deleted and store.registerModule('core', coreModule) removed from kolibri/core/frontend/index.js
  • [ ] KolibriApp: get store(), get pluginModule(), get stateSetters(), and setupVue() removed
  • [ ] startRootVue() no longer passes a store to new Vue()
  • [ ] createStore utility added to packages/kolibri-common
  • [ ] Existing plugins updated to use createStore + RootVue pattern
  • [ ] All existing tests pass — test infrastructure updated as needed, but no changes to behavioural assertions
  • [ ] PR includes screenshots of every app landing page demonstrating manual testing

References

  • packages/kolibri-app/src/index.js — primary target for KolibriApp cleanup

AI usage

This issue was drafted with Claude Code (Opus) based on codebase analysis of how Vuex is integrated into the core framework, as part of the broader Vuex removal tracked in #11722.

rtibbles avatar Apr 01 '26 03:04 rtibbles

Plan: Move Vuex out of the Kolibri core framework so that plugins which still use Vuex create and own their own stores.

  • [x] createStore utility in kolibri-common
  • [x] Coach plugin owns its store
  • [x] Device plugin owns its store
  • [x] Facility plugin owns its store
  • [x] Learn plugin owns its store
  • [x] Setup wizard plugin owns its store
  • [x] User profile plugin owns its store
  • [x] Delete the dead Vuex modules in policies, user_auth, and my_downloads
  • [x] Strip Vuex out of KolibriApp
  • [x] Drop the unused store fixtures from shared-package tests
  • [x] Delete the core store singleton, the core Vuex module, and the vuex core export
  • [x] Manual verification with screenshots of every app landing page

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Jul 25 '26 06:07 rtibblesbot

All acceptance criteria are complete in #15089.

The plan checklist above is ticked. I can't tick the boxes in the issue body — no write permission on the issue — so status is recorded here.

Criterion Where
packages/kolibri/store.js deleted 808341749f
Vue.use(Vuex) removed from packages/kolibri/index.js 808341749f
vuex dropped from packages/kolibri/package.json, apiSpec.js regenerated 808341749f
coreStoreFactory removed 808341749f
Core Vuex module deleted, registerModule('core', …) gone from kolibri/core/frontend/index.js 808341749f
KolibriApp: get store(), get pluginModule(), get stateSetters(), setupVue() removed 740e751d63
startRootVue() passes no store to new Vue() 740e751d63
createStore added to kolibri-common 27f801bd4d
Six plugins on the createStore + RootVue pattern 8e306f430a…7f09ce83d1
All tests pass, no behavioural assertions changed pnpm test-jest green
Screenshots of every app landing page PR body, "Manual verification"

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

rtibblesbot avatar Jul 25 '26 10:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 25 '26 13:07 rtibblesbot