Skip to content

Conversation

@kyleorin
Copy link

@kyleorin kyleorin commented Dec 28, 2025

Reduces sidebar load time by deferring involvement button rendering until user interaction.
Changes

Involvement buttons now load on hover/focus instead of initial page load
Static placeholder icons display immediately, replaced by interactive buttons when needed
Added system test for lazy loading behavior

How it works

Each room item shows a lightweight placeholder icon. When users hover over a room, a Turbo Frame fetches the actual involvement button. This reduces initial DOM size significantly.
Files changed

app/views/users/sidebars/rooms/_shared.html.erb - Lazy loading via Turbo Frames
app/frontend/controllers/lazy_involvement_controller.js - Stimulus controller for on-demand loading
app/frontend/controllers/sidebar_loading_controller.js - Loading state management
app/assets/stylesheets/application/sidebar.css - Placeholder and loading styles
test/system/sidebar_lazy_loading_test.rb - System test

Closes #23
AI Disclosure

Model: Claude Opus 4.5 via Claude Code
Used for: Codebase exploration, understanding existing patterns, code generation (Stimulus controllers, CSS, ERB templates), test writing
All code reviewed and follows existing codebase patterns

Fixes #23

- Add lazy loading for involvement buttons, deferring their load until
  user hovers over a room item. This reduces initial DOM size and
  speeds up sidebar rendering.
- Create lazy_involvement_controller.js Stimulus controller to handle
  on-demand loading of involvement buttons via Turbo Frames
- Create sidebar_loading_controller.js for managing loading states
- Add CSS for loading states, involvement placeholders, and smooth
  transitions when buttons load
- Display static involvement icon placeholder initially, replaced by
  interactive button on hover/focus

Fixes antiwork#23
Verifies that involvement buttons load lazily on hover and that
the sidebar displays correctly on initial load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rooms sidebar takes over 3 seconds to load on full refresh

2 participants