[2.x] Component helper for lazy loading components

Open
#4,220 0 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
frontend, web-dev

Research direction

No file, test, or entry point is named. Start by reading the existing component system and how code-split components are imported; then determine the API for passing an imported component and an optional loader. Done means a single component can show fallback content while its import resolves, without requiring the broader behavior of React Suspense.

Written by the indexing model from the issue text.

Description

type/extensibility

Similar to React's <Suspense> (but way less complex), pass a code split component and optionally a custom loader to show while it is being imported.

A simple "just loading" component could be fairly nice for components that don't need to be tightly integrated with the parent, just to avoid a lot of boilerplate loading indicators and stuff. Not necessarily as complicated as the Suspense as that goes deep in the children, but just for a single component.

Something like this (might make sense to do it some other way, but you get the idea)

<LazyComponent
    content={import('...')}>
    This text is shown while loading
</LazyComponent>

I could see this also being useful perhaps to just show a LoadingIndicator when the param loading is true, maybe. But that's not the focus.

Dominant language
PHP
Stars
6.8k
Forks
891
Avg merge
1d 10h
Merged PRs (30d)
209

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flarum/framework

All issues in flarum/framework

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.