{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-import-on-interaction-d21d3f165d87","title":"Optimize Initial Load with Import-on-Interaction","summary":"Reduce initial load time by deferring non-critical code until user interaction. This includes features like chat widgets, maps, and export functionality that are not needed for the first viewport or core task completion.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-import-on-interaction-d21d3f165d87","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-import-on-interaction-d21d3f165d87","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-import-on-interaction-d21d3f165d87.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-import-on-interaction-d21d3f165d87\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the initial render works without the deferred feature and provide immediate UI feedback while the deferred chunk loads.","instructions":"---\nname: import-on-interaction\ndescription: \"Use when reviewing slow initial loads caused by optional features. Prioritize code that is expensive to download or execute and not required for the first viewport, first input, or core task completion.\"\nmetadata:\n  category: performance\n  priority: high\n  difficulty: intermediate\n  estimatedTime: \"20\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/performance\/import-on-interaction\n---\n\n# Load non-critical code on user interaction\n\nUsers should not pay the download, parse, and execution cost for features they may never use. Import-on-interaction shrinks initial JavaScript, reduces main-thread work during page load, and keeps the first view focused on content that matters immediately.\n\n## Quick Reference\n\n- Move non-essential code behind clicks, focus, hovers, or explicit user actions\n- Use dynamic import() so the code is absent from the initial route bundle\n- Show immediate UI feedback while the deferred chunk loads\n- Use this for chat widgets, editors, maps, filters, and export flows that are not needed on first paint\n\n## Check\n\nInspect this route or component for heavy modules, widgets, or third-party scripts that load on first render but are only needed after a user clicks, focuses, hovers, or opens a panel.\n\n## Fix\n\nMove the non-critical dependency behind a user-triggered dynamic import(), add immediate loading feedback, and ensure the initial render still works without the deferred feature.\n\n## Explain\n\nExplain import-on-interaction, why it improves initial performance, and which features are safe to defer until the user shows intent.\n\n## Code Review\n\nInspect event handlers, modal triggers, drawers, editors, maps, export actions, and third-party widgets. Flag code that is included in the initial bundle even though it is only needed after a user interaction, and verify the fix keeps the initial path lighter without degrading the triggered flow.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/performance\/import-on-interaction\n","use_cases":["Deferring chat widgets","Lazy-loading maps","Delaying export functionality","Optimizing third-party scripts"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/import-on-interaction\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T16:34:08.000000Z","updated_at":"2026-11-23T04:55:22.000000Z","seo_title":"Optimize Initial Load with Import-on-Interaction","seo_description":"Reduce initial load time by deferring non-critical code until user interaction. Improve performance and user experience by using dynamic import() and showing immediate UI","seo_keywords":["import-on-interaction optimization","defer non-critical code","improve initial load performance","user interaction loading","reduce main-thread work"]}}