maxheld83 / biblids

Validating with bibliometric identifiers
https://maxheld.de/biblids/
MIT License
2 stars 1 forks source link

share i18n object between server and ui #100

Closed maxheld83 closed 3 years ago

maxheld83 commented 3 years ago

the object currently gets created twice, which may cause problems in future and is just confusing.

This was necessary, because with a shared object created outside of the server context, the tests (shinytest) throw a warning:

── Error (test-doi.R:150:3): App starts editable and not submitable ────────────
618
Error: Identified global objects via static code inspection (function (input, output, session); ***; shiny::observe(shiny.i18n::update_lang(session, input$lang)); i18n_server <- shiny::reactive(***; i18n$set_translation_language(input$lang); i18n; ***); doiEntryServer(id = "test", i18n_server = i18n_server); ***). Failed to locate global object in the relevant environments: 'i18n'
619
Backtrace:
620
     █
621
  1. └─shinytest::ShinyDriver$new(doiEntryApp()) test-doi.R:150:2
622
  2.   └─shinytest:::initialize(...)
623
  3.     └─shinytest:::sd_initialize(...)
624
  4.       └─shinytest:::app_save(path)
625
  5.         └─shinytest:::app_data(app, env)
626
  6.           └─shinytest:::app_server_globals(server, env)
627
  7.             └─globals::globalsOf(server, envir = env, recursive = FALSE)
628
  8.               └─base::tryCatch(...)
629
  9.                 └─base:::tryCatchList(expr, classes, parentenv, handlers)
630
 10.                   └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
631
 11.                     └─value[[3L]](cond)

It could be that this is a spurious warning, as in furrr per https://stackoverflow.com/questions/64006043/using-tidy-evaluations-with-furrr/64009850#64009850 and https://github.com/HenrikBengtsson/globals/issues/65,

but it could also be a legit issue, potentially because I'm using the wrong domain in reactive().