Appsilon / rhino

Build high quality, enterprise-grade Shiny apps at speed
https://appsilon.github.io/rhino
287 stars 24 forks source link

Refactor `rhino::app()` #556

Closed kamilzyla closed 7 months ago

kamilzyla commented 8 months ago

Changes

A major refactor of rhino::app(). Each change corresponds to a single commit - it might be easier to review them one by one:

  1. Organize code in R/app.R with top-down approach: start with rhino::app() and go from more general to more specific functions.
  2. Add load_main_source() and load_main_box() helpers to clearly distinguish these two mechanisms.
  3. Make initial configuration done by rhino::app() more readable with three configure_*() functions.
  4. Normalize the UI and server functions after loading the main module so they always have the same signature and the rest of the code (e.g. with_head_tags()) doesn't need to handle multiple cases.
  5. Simplify with_head_tags().
  6. Improve the server reloading workaround and add better comments.
  7. Further simplify rhino::app() using load_main() and make_app() helpers.
  8. Refactor and expand unit tests.

This PR is intended to be pure refactoring, so Rhino behavior should remain unchanged. However, the normalization step (4) actually has a user-observable benefit: the request parameter is now correctly passed to the UI if it uses it (closes #395).

Additional testing

The How-to: Use shinymanager presents an example which uses both shinymanager and Shiny bookmarking. I have used it as a basis for testing all settings of legacy_entrypoint.

codecov-commenter commented 8 months ago

Codecov Report

Attention: 25 lines in your changes are missing coverage. Please review.

Comparison is base (a72120b) 26.91% compared to head (4b1dfc4) 28.72%.

:exclamation: Current head 4b1dfc4 differs from pull request most recent head 0d2af1b. Consider uploading reports for the commit 0d2af1b to get more accurate results

Files Patch % Lines
R/app.R 60.93% 25 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #556 +/- ## ========================================== + Coverage 26.91% 28.72% +1.80% ========================================== Files 10 10 Lines 457 477 +20 ========================================== + Hits 123 137 +14 - Misses 334 340 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.