Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

live reload when on an error page #58

Open
Nowaker opened this issue May 1, 2014 · 5 comments
Open

live reload when on an error page #58

Nowaker opened this issue May 1, 2014 · 5 comments

Comments

@Nowaker
Copy link

Nowaker commented May 1, 2014

Live reload works great until an exception is not raised. When a stacktrace is shown, live reload will no longer reload the page on file change. I have to do that manually by hitting F5 in the browser.

@bhollis
Copy link
Contributor

bhollis commented May 2, 2014

That makes sense. The error middleware is probably before the LiveReload middleware.

@Nowaker
Copy link
Author

Nowaker commented Aug 9, 2014

I tried putting live reload middleware in front by hacking ::Middleman::Extensions.@_registered but it didn't help. Missing livereload script still doesn't show up on error page. rack-livereload issue? I'd rather you checked if it is or not, you're more competent than me.

BTW, this is what I added to middleman-core/extensions.rb and then made middleman-livereload.rb to use this method. That's not a quality code (duplicates all the code from register) but is a good start in case both adding livereload to front and patching rack-livereload are needed to resolve this issue.

      def registered
        @_registered ||= ActiveSupport::OrderedHash.new
      end

      def register_first(name, namespace=nil, &block)
        return if registered.key?(name.to_sym) &&
        !registered[name.to_sym].is_a?(String)

        old = registered
        reordered = {}
        reordered[name.to_sym] = if block_given?
          block
        elsif namespace
          namespace
        end
        reordered.merge! old

        @_registered = reordered
      end

@tdreyno
Copy link
Member

tdreyno commented Aug 9, 2014

Sounds like this could be fixed by the extension priority ordering in v4, right?

@sandstrom
Copy link
Contributor

sandstrom commented Jul 28, 2017

I'm doing some issue-gardening 🌿🌷🌾 and came across this issue.

Sorry that this has lingered for quite a while!

Does this work better under v4? If so can we close this issue?

(this repo is maintained by a few people contributing their free time, unfortunately we can't solve every issue on our own, so help from others is needed for some of the more exotic issues that crops up)

@Nowaker
Copy link
Author

Nowaker commented Jul 28, 2017

@sandstrom I'll check how it works in v4. Thanks for a ping.

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

No branches or pull requests

4 participants