Implementation:AFK surf Open agent Starter Effects
| Knowledge Sources | |
|---|---|
| Domains | Editor, Web_Components, BlockSuite |
| Last Updated | 2026-10-25 00:00 GMT |
Overview
Concrete side-effect initializers that register Lit custom elements and obtain the store/view extension managers for the BlockSuite starter playground.
Description
The starter entry point (main.ts) runs three module-load-time side effects before the editor is created: itEffects() registers the integration-test Lit elements and block definitions; getTestStoreManager() returns a StoreExtensionManager preconfigured with the test providers; commentEffects() registers the comment-app Lit elements. These calls must execute before any editor instance is constructed so that the custom element registry and the DI container are populated.
Usage
Import and invoke these functions at the very top of an application entry point when bootstrapping a BlockSuite editor. They are the prerequisite for every subsequent step (collection creation, editor container, mounting).
- Standard bootstrap: call all three at module load, then proceed to collection creation.
- E2E test bootstrap: itEffects() is still required; the store manager seeds test extensions.
Code Reference
Source Location
- Repository: Open-Agent
- File: blocksuite/playground/apps/starter/main.ts (imports L11-19, calls L23-25)
Signature
// From @blocksuite/integration-test/effects
function itEffects(): void;
// From @blocksuite/integration-test/store
function getTestStoreManager(): StoreExtensionManager;
// From ../comment/effects.js
function commentEffects(): void;
Import
import { effects as itEffects } from '@blocksuite/integration-test/effects';
import { getTestStoreManager } from '@blocksuite/integration-test/store';
import { effects as commentEffects } from '../comment/effects.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | These are parameterless side-effect initializers |
Outputs
| Name | Type | Description |
|---|---|---|
| storeManager | StoreExtensionManager | A configured manager exposing store-scoped extensions via get('store') |
| registry | void | Lit custom elements + block definitions registered in the global registry |
Usage Examples
Standard Bootstrap
import { effects as itEffects } from '@blocksuite/integration-test/effects';
import { getTestStoreManager } from '@blocksuite/integration-test/store';
import { effects as commentEffects } from '../comment/effects.js';
// Run side effects at module load time, BEFORE any editor is created.
itEffects();
const storeManager = getTestStoreManager();
commentEffects();
// storeManager is now ready to feed into createStarterDocCollection.