lookbook-hq / lookbook

A UI development environment for Ruby on Rails apps ✨
https://lookbook.build
MIT License
912 stars 94 forks source link

Lookbook::Reloaders#execute gets call after every code update on refresh #635

Closed adrienpoly closed 3 months ago

adrienpoly commented 3 months ago

Describe the bug

I have an app using Lookbook and view components with a fair amount of components. I have been struggling for a while with slow application refresh when I update code. I recently used Vernier to profile a full app reload (ie when I update some code in a view by example and refresh the page.

What I noticed is that what ever code update I make. All Lookbook previews seems to fully reload (Lookbook::Reloaders#execute is called) and in my case it takes 600ms. This delay is quite annoying for Front End work. I wonder if this is something that someone else noticed or if I have something wrongly setup

I do use view_component-contrib with a file structure like that

components/
    example/
      component.html
      component.rb
      preview.rb

Expected behavior

I dont see why all previews are reloaded when I update a file in a view or a controller

Screenshots

CleanShot 2024-07-29 at 21 42 09@2x

Version numbers

Please complete the following information:

adrienpoly commented 3 months ago

after further investigation it doesn't seems to occur for every code change, I need more digging to understand where it comes from. I am closing the issue for now and will reopen if I can come up with something reproductible