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

Checks for register_theme_element(element_tree) #6169

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6162.

Aside from throwing an error in de issue's case, I also included stricter checks on the structure of the element_tree argument.
There is the possibility this might break packages that define their own theme elements, but if so, they've been using it incorrectly.

Reprex from issue:

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
register_theme_elements(
  foobar = element_rect(),
  element_tree = list(foobar = el_def("element_rect", inherit = "foobar"))
)
#> Error in `register_theme_elements()`:
#> ! Invalid parent in `element_tree`: "foobar".

Created on 2024-10-29 with reprex v2.1.1

Merge branch 'main' into circular_theme_registry

# Conflicts:
#	tests/testthat/_snaps/theme.md
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.

Circular register_theme_element() bug
1 participant