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

fix override when included in as_pkgdown #2406

Merged
merged 6 commits into from
Mar 11, 2024
Merged

Conversation

dsweber2
Copy link
Contributor

@dsweber2 dsweber2 commented Mar 1, 2024

Fixes #2257. I wasn't exactly sure where to put the test, but figured it was better to include a brief test somewhere.

As with the other issue, I actually ran into this doing build_site_github_pages(), but figured it was better to fix at the root

R/package.R Outdated
@@ -9,6 +9,11 @@
#' @export
as_pkgdown <- function(pkg = ".", override = list()) {
if (is_pkgdown(pkg)) {
if (is.list(pkg$meta)) {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for digging this up! Can you please use modify_list() instead since that already handles the NULL case, which should simplify this code a bit 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just copying the version a couple of lines down; I just changed that one to modify_list too for consistency sake

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, also, I was checking if x rather than y is null; there are cases when pkg$meta is NULL. I just included a change to modify_list that checks both arguments so we can use that instead like you were suggesting.

Copy link
Member

Choose a reason for hiding this comment

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

Perfect, thanks!

@@ -46,3 +46,13 @@ test_that("site meta doesn't break unexpectedly", {

expect_snapshot(yaml)
})

test_that("override works correctly for as_pkgdown", {
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest putting this test in test-package.R since that's corresponds to the file where you changed the code.

@@ -86,7 +86,7 @@ isFALSE <- function(x) {
}

modify_list <- function(x, y) {
if (is.null(y)) {
Copy link
Member

Choose a reason for hiding this comment

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

If x is NULL I think you should return y?

@hadley hadley merged commit 1924ebf into r-lib:main Mar 11, 2024
13 checks passed
dshemetov added a commit to cmu-delphi/epiprocess that referenced this pull request Apr 25, 2024
David's fix was merged into pkgdown and it was released (thank you @hadley)! r-lib/pkgdown#2406 

Remove CI workaround.
SebKrantz pushed a commit to SebKrantz/pkgdown that referenced this pull request Jun 1, 2024
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.

override is ignored in as_pkgdown() on pkgdown objects
2 participants