Problem statement
A small analytics tile keeps its heavy chart module out of the first paint. It is loaded on demand when the user clicks Load, shows a loading indicator while the load is in flight, an error strip with Retry if it fails, and reuses the module without re-loading it on any click after the first success, using Vanilla TypeScript and standard DOM APIs.
Demo
The page, styles, seeded data, DOM helpers, the chart module itself, and the entry wiring are already scaffolded and wired. Only the loader in src/js/chartLoader.ts is missing. Implement it so every test passes. Do not edit any other file.
What to implement
- Keep the chart module out of the page until the user clicks Load. It should never be loaded ahead of time.
- Show a loading indicator as soon as Load is clicked, and hide it as soon as the load finishes.
- Show the chart in the tile when the load succeeds.
- Show an error strip with a Retry button when the load fails, and re-attempt the load when Retry is clicked.
- Do not re-load the chart module on any click after the first success. Reuse the one already in memory.
- Do not remember a failed attempt. The next attempt after a failure must start clean.
- Everything shown must come from the seeded data. Nothing should be hardcoded.
