Skip to content

Commit

Permalink
ensure new data reading is backwards compatible (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
vandenman authored Oct 8, 2024
1 parent 8fbfa2a commit 9fd59c5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ preloadDataset <- function(datasetPathOrObject, options) {

dataset <- convertToTypes(dataset[variables], types, datasetPathOrObject)

.setInternal("dataset", dataset)
.setInternal("preloadedDataset", dataset)

}

Expand Down
5 changes: 4 additions & 1 deletion R/options.R
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ parsePreloadDataFromDescriptionQml <- function(analysisName) {

preloadData <- isTRUE(description[["Description"]][["preloadData"]]) || isTRUE(description[[analysisName]][["preloadData"]])
if (!preloadData)
warning("Analysis ", analysisName, " does not preload data. Please update the code.")
lifecycle::deprecate_warn(
when = "0.19.2",
what = I(sprintf("The analysis `%s` does not preload data. Please update inst/Description.qml, add `preloadData: true`, and fix any minor issues.", analysisName))
)

return(preloadData)

Expand Down
2 changes: 1 addition & 1 deletion R/rbridge.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}

.readDataSetRequestedNative <- function() {
return(.getInternal("dataset"))
return(.getInternal("preloadedDataset"))
}

.requestTempFileNameNative <- function(...) {
Expand Down
1 change: 1 addition & 0 deletions R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ initAnalysisRuntime <- function(dataset, options, makeTests, ...) {
reinstallChangedModules()

# dataset to be found in the analysis when it needs to be read
.setInternal("dataset", dataset)
preloadDataset(dataset, options)

# prevent the results from being translated (unless the user explicitly wants to)
Expand Down

0 comments on commit 9fd59c5

Please sign in to comment.