Package developers register a function called with the ui at the start of a ui solve, before parameter loaders run. Use it to rehydrate transient C-side state from serializable ui slots (so a ui saved to disk and reloaded in a fresh session solves correctly). The hook must be cheap and a no-op for models it does not own.
Examples
# \donttest{
mod <- function() {
ini({
k <- 0.1
})
model({
d/dt(A) <- -k * A
})
}
seen <- new.env()
seen$n <- 0L
rxRegisterUiPrep("myPkg:count", function(ui) seen$n <- seen$n + 1L)
s <- rxSolve(mod, et(amt = 100) |> et(0:4))
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#>
#>
seen$n
#> [1] 1
rxRemoveUiPrep("myPkg:count")
# }
