Skip to content

docs: fix FRONTEND_SLOTS slot operation example - #325

Open
arbrandes wants to merge 1 commit into
overhangio:releasefrom
arbrandes:arbrandes/fix-frontend-slots-docs
Open

docs: fix FRONTEND_SLOTS slot operation example#325
arbrandes wants to merge 1 commit into
overhangio:releasefrom
arbrandes:arbrandes/fix-frontend-slots-docs

Conversation

@arbrandes

Copy link
Copy Markdown
Collaborator

Description

The FRONTEND_SLOTS example in the README doesn't work as documented. Its op field used a plain string literal, but op is typed as a TypeScript enum in frontend-base, so op: 'widgetReplace' fails the type check when customApp.tsx is built. The example now imports WidgetOperationTypes through the mfe-site-custom-app-imports patch and uses WidgetOperationTypes.REPLACE. The paragraph claiming the string values were equivalent, and not worth an import, is gone.

The example's relatedId: 'defaultContent' was also wrong. In frontend-base, defaultContent is the id of the widget synthesized from a slot's JSX children, but the shell renders the footer slot without children and fills it by appending a widget with the id org.openedx.frontend.widget.footer.main.v1. A relatedId that matches nothing is silently ignored, so the documented operation had no effect at all. The example now targets that widget id.

Finally, the list of available operations names the enum constants instead of their underlying string values, so it matches what a plugin author actually has to write.

LLM usage notice

Built with assistance from Claude.

The op field takes WidgetOperationTypes constants, not string literals,
which fail the type check in customApp.tsx. Also, relatedId must match
the widget id the shell appends to the footer slot.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Triage

Development

Successfully merging this pull request may close these issues.

Incorrect documentation for theming with FRONTEND_SLOTS

2 participants