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

Add tagAddRenderHook() function #215

Merged
merged 24 commits into from
Apr 21, 2021
Merged

Add tagAddRenderHook() function #215

merged 24 commits into from
Apr 21, 2021

Conversation

schloerke
Copy link
Collaborator

@schloerke schloerke commented Apr 15, 2021

tagFunction()s are black boxes and do not provide plausible tag structures. Typically with tagFunction()s, the tag structure is known and only a class value or html dependency is added.

To provide a better default tag structure, TAG$.renderHooks will contain a list of render functions. When converted to tags with as.tags(TAG), if a render hook exists, as.tags.shiny.tag(TAG) will remove a single render hook, call it, and call as.tags(TAG2). This recursion will continue until no more render hooks exist. (To be safe, the hook is removed from TAG before calling hook(TAG).)

Using tagAddRenderHook() (mixed with tagQuery()) will be preferred over using generic tagFunction()s.

R/tags.R Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
schloerke and others added 3 commits April 16, 2021 13:23
* Use rlang to eval the `tagname` when making the function

* document

* Use new_function() approach

Co-authored-by: Carson <cpsievert1@gmail.com>
R/tags.R Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
schloerke and others added 2 commits April 16, 2021 16:02
Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
@cpsievert cpsievert marked this pull request as ready for review April 16, 2021 22:39
@cpsievert cpsievert changed the title Add tag $.render function Add tagRenderHook() function Apr 16, 2021
NEWS.md Outdated Show resolved Hide resolved
@wch
Copy link
Collaborator

wch commented Apr 20, 2021

The other tag* functions have a verb in the name, like tagAddChildren(), tagAppendAttributes(), etc. Can we rename this so that there's a verb in the name, as in tagAddRenderHook?

R/tags.R Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
* master:
  Rename `rlang::sexp_address()` to `rlang::obj_address()` (#220)
  Set min `rlang` version to 0.4.10.9000
…nc, add = TRUE)` to `tagAddRenderHooks(x, func, replace = FALSE)`
@schloerke schloerke requested a review from wch April 20, 2021 21:27
@schloerke schloerke changed the title Add tagRenderHook() function Add tagAddRenderHook() function Apr 20, 2021
R/tags.R Outdated Show resolved Hide resolved
R/tags.R Show resolved Hide resolved
@schloerke
Copy link
Collaborator Author

(The error above is a GHA false positive error due to a caching failure.)

NEWS.md Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
R/tags.R Outdated Show resolved Hide resolved
@cpsievert
Copy link
Collaborator

LGTM pending minor nitpicks 👍

schloerke and others added 5 commits April 21, 2021 15:55
* master:
  Return invisibly when not creating a new tagQuery() object (#228)
Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
@schloerke schloerke merged commit 056f634 into master Apr 21, 2021
@schloerke schloerke deleted the tag_render_fn branch April 21, 2021 20:10
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.

3 participants