beeware / beeware/toga

Use Shoelace autoloader in web static template

Open
#1,907 1 comment 0 reactions 0 assignees View on GitHub
enhancement web
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

Shoelace, the component framework used in the web platform, offers two component loaders. The autoloader lazy loads components when they're used, and the traditional loader loads all components eagerly. The autoloader was used initially when only a few components were implemented, but I had to switch it to the traditional loader because I couldn't figure out how to get the autoloader to realize we wanted it to load things in the pyodide context. Any increase in load time appears to be between slight and negligible, but the lazy loader is still probably preferable, if anyone can figure out how to make it work.

### Describe the solution you'd like

Figure out how to get the Shoelace autoloader to activate in pyodide and load the components we use before we hit attribute errors trying to use them.

### Describe alternatives you've considered

None. I can't move forward adding Toga web widgets with the autoloader, I just can't make it work.

### Additional context

Anyone from pyodide able to figure this out? <3

See the change in the [template](https://github.com/beeware/briefcase-web-static-template/pull/8).

Contributor guide

Open the contributing guide

Research direction

Start with the web static template change referenced in briefcase-web-static-template#8 and the Shoelace loader setup used by the web platform. Investigate how the autoloader can load components in the Pyodide context before use, then verify that the relevant components no longer produce attribute errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
frontend, web-dev
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.