Skip to content

fix: Options not written before use#357

Merged
mhovd merged 2 commits into
mainfrom
fix-pmoptions
Jun 23, 2026
Merged

fix: Options not written before use#357
mhovd merged 2 commits into
mainfrom
fix-pmoptions

Conversation

@mhovd

@mhovd mhovd commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Changes:

  • PMoptions.R — getPMoptions() now prefers the user file but falls back to the packaged defaults when it's missing (or the path is NA), so it never returns -1 when sane defaults ship with the package.
  • PMoptions.R — setPMoptions() now writes options first and only builds/launches the Shiny app when launch.app = TRUE, so the package-load path no longer depends on constructing the app.
  • PMoptions.R — dir.create() is now recursive = TRUE. PM_report.R — the HTML fallback now normalizes any unrecognized template ("app", -1, NULL) to a valid default instead of erroring in switch().

Resolves #304

Changes:
PMoptions.R — getPMoptions() now prefers the user file but falls back to the packaged defaults when it's missing (or the path is NA), so it never returns -1 when sane defaults ship with the package.
PMoptions.R — setPMoptions() now writes options first and only builds/launches the Shiny app when launch.app = TRUE, so the package-load path no longer depends on constructing the app.
PMoptions.R — dir.create() is now recursive = TRUE.
PM_report.R — the HTML fallback now normalizes any unrecognized template ("app", -1, NULL) to a valid default instead of erroring in switch().

Resolves #304

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses first-install/report-generation failures caused by missing user option files by making option loading more robust and ensuring defaults are persisted before any interactive UI is constructed.

Changes:

  • Update getPMoptions() to prefer the user options file but fall back to packaged defaults when the user file is missing/invalid.
  • Update setPMoptions() to write/sync options before optionally building and launching the Shiny options app; also create the options directory recursively.
  • Harden PM_report() HTML fallback behavior by normalizing invalid/unrecognized templates to a valid default before switch().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
R/PMoptions.R Ensures defaults are discoverable on fresh install and decouples options persistence from launching the Shiny UI.
R/PM_report.R Prevents HTML fallback report generation from erroring on invalid/legacy option values for report_template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/PM_report.R
Comment thread R/PM_report.R
Comment thread R/PMoptions.R
@mhovd mhovd merged commit 43d0e8b into main Jun 23, 2026
9 checks passed
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.

PMoptions not written on install

3 participants