fix: Options not written before use#357
Merged
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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 beforeswitch().
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.
Siel
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
Resolves #304