ThinkR-open / ThinkR-open/golem

Golem should discourage the use of raw JS on shiny elements and/or point to safe alternatives

Open
#449 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
945
Forks
136
PR merge metrics
No merged PRs in 30d

Description

(This is regarding both golem and its "engineering shiny" book - because the book is listed in the README as "The book" for golem, I thought it's appropriate to open the issue here)

I think Golem does a fantastic job at prividing and explaining a practical useful framework for building shiny apps.

I do have some worries however about the javascript guidelines that golem/the book provides. Teaching the basics of javascript to the average R user is not an easy task, and you've done this very well. But writing robust javascript code that interacts with shiny is not a trivial task, and I think golem/the book does a disservice to shiny devs by recommending the use of .show() .hide() etc. in custom javascript code or recommending the use of golem's javascript functions. There are several issues with this approach, such as the fact that shiny won't know about the inputs being shown/hidden so it will not render them efficiently, and if the uer wants to hide an input then they'll have a very hard time figuring out the correct selector. Because these are common and useful things to want to do, there is a package dedicated to exactly that - shinyjs (disclaimer: it's my package). And it also provides a mechanism similar to what golem tries to achieve with invoke_js. I feel that the strength of goelm is in providing the framework for a shiny app, and the javascript bits are a bit out of scope for golem's missions and they feel like reinventing the wheel when there is a much better solution already.

I realize this may seem as biased and self-interested because of my package - but I truly believe the golem/book guidelines are not in the best interest of users.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the README references to the golem book and the JavaScript guidance around .show(), .hide(), and invoke_js. Compare those recommendations with shinyjs, then determine whether the book, golem guidance, or both should change. Done means the documentation clearly directs users toward a safe, agreed approach for manipulating Shiny elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.