Skip to content

Trigger livereload in sites without pages#8337

Merged
jekyllbot merged 3 commits intojekyll:masterfrom
ashmaroli:livereload-all-types
Mar 21, 2022
Merged

Trigger livereload in sites without pages#8337
jekyllbot merged 3 commits intojekyll:masterfrom
ashmaroli:livereload-all-types

Conversation

@ashmaroli
Copy link
Copy Markdown
Member

  • This is a 🐛 bug fix.

Summary

Livereload should be triggered even if the site doesn't have a single standalone page.

Context

Resolves #8332
/cc @jaybe-jekyll

@ashmaroli ashmaroli added the fix label Aug 12, 2020
@ashmaroli ashmaroli marked this pull request as ready for review August 26, 2020 13:59
@ashmaroli ashmaroli requested a review from a team August 26, 2020 14:00
Copy link
Copy Markdown
Member

@DirtyF DirtyF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need a test for this?

@ashmaroli
Copy link
Copy Markdown
Member Author

Don't we need a test for this?

We do. But I couldn't come up with a test implementation..

@ashmaroli ashmaroli added this to the 4.2 milestone Sep 25, 2020
@ashmaroli
Copy link
Copy Markdown
Member Author

@parkr I'm not able to come up a good test for the proposed change here. Will you be able to help..?

@DirtyF DirtyF modified the milestones: 4.2, flexible Nov 28, 2020
@ashmaroli
Copy link
Copy Markdown
Member Author

@mattr- Requesting your help to add a test for this.. Whatsay?

@ashmaroli
Copy link
Copy Markdown
Member Author

@parkr Requesting your help to add some test for this.

regenerator = Jekyll::Regenerator.new(site)
@changed_pages = site.pages.select do |p|
regenerator.regenerate?(p)
@changed_pages ||= []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation always reset this variable, the new implementation only adds, never removes. Is that intended?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I did not realize that the array never gets reset !!
Definitely not intended. 🤦‍♂️

@parkr
Copy link
Copy Markdown
Member

parkr commented Mar 10, 2022

I'd use mocks to test for this. I'd have a fake regenerator that tells me to regenerate a non-Page object and ensure it's included in the changed pages list?

@parkr
Copy link
Copy Markdown
Member

parkr commented Mar 10, 2022

If this didn't break tests, I'm fine shipping it without an additional one. We can come back to making tests for LiveReload if you don't have time to tackle this.

@ashmaroli
Copy link
Copy Markdown
Member Author

@jekyllbot: merge +fix

@jekyllbot jekyllbot merged commit 94dc98c into jekyll:master Mar 21, 2022
@jekyllbot jekyllbot added the bug label Mar 21, 2022
@ashmaroli ashmaroli deleted the livereload-all-types branch March 21, 2022 15:00
jekyllbot added a commit that referenced this pull request Mar 21, 2022
github-actions bot pushed a commit that referenced this pull request Mar 21, 2022
Ashwin Maroli: Trigger livereload in sites without pages (#8337)

Merge pull request 8337
@jekyll jekyll locked and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

livereload fails to function without at least one 'page' present

4 participants