Skip to content

Missing 'export default' in three platform page components #752

Description

@payamnj

Three platform page components are missing `export default ComponentName;` at the end of the file, unlike every other platform page (e.g. `frontend/platform/course/Course.jsx`, which ends with `export default Course;` after its `render(...)` call):

  • `frontend/platform/organization/Organization.jsx` (component: `Organization`)
  • `frontend/platform/learners/Learners.jsx` (component: `Learners`)
  • `frontend/platform/analytics/Analytics.jsx` (component: `Analytics`)

Impact

Harmless in production — each file's `render({ children: })` call mounts the component directly as a side effect at module load, so the missing export never mattered at runtime.

However, it means the component can never be `import`ed by a test file (`import X from '.../X.jsx'` resolves to `undefined`, and React then throws `Element type is invalid: expected a string ... but got: undefined` on render) — which is exactly why none of these three pages currently have any test coverage.

Fix

Add `export default ComponentName;` as the last line of each of the three files, mirroring the exact pattern already used in `frontend/platform/course/Course.jsx`.

This was already found and fixed for two sibling pages (`Newsletter.jsx` and `NewsletterSubscribers.jsx`) on the in-progress branch `newsletter-embed-widget` while adding tests for them.

Verify with `npm run test -- --run` in `frontend/` that nothing breaks after the change. No new test files are required as part of this fix — leaving the components still untested-but-now-importable is fine; the export fix itself is the priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions