-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] Pseudo-modules: a function to create a pseudo-module that shares the same namespace as it's parent module environment. #995
Comments
A rough draft is here, borrowing from |
Hey @VincentGuyader & @ColinFay, Also wondering if y'all would be up for adding I can create a PR for this request if y'all think it would be a nice addition? |
I think this pseudo-module idea is really nice and interesting, @yogat3ch! It seems tied to a design pattern for specific scenarios which is cool. But, could you maybe add a simple example in the function's This would help people like me get a better grasp on when and how to use this approach. I get the abstract part:
But a concrete example would be super helpful! 😅 This extra context might not only help me but also others less familiar with |
I already needed something like this, and would be nice to have some solution like yours @yogat3ch. |
Hi @ilyaZar and @mikael04, I've also modified Hope this is helpful! |
Hey folks, I feel like this is a good use case for the |
@ColinFay Ahh, that looks like the solution we're looking for! Thanks! |
@yogat3ch awesome! Please let me know if you open source this, I'll be happy to link it as an example in the doc :) |
In a deeply nested modular shiny app, there is often a need to functionalize pieces of UI/Server functionality that will generate inputs & outputs for which there can be additional interactivity in the top-level module.
Current practice usually involves making this UI/Server functionality into a module using
add_module
that then changes the namespace. Inputs are then passed from the module up to the parent via thesession$userData
object, an object in the global or package namespace environment, or via areactiveVal/ues
passed into the module as an argument.Wouldn't it be easier in many cases to just have the UI/Server functionality create additional input/outputs in the parent modules namespace?
Describe the solution you'd like
Here's an example of what a pseudo-module might look like using a convenience function that finds the
ns
function automaticallyshinyVirga::ns_find
:Such a pseudo-module will create input/output directly in it it's parent UI/server module namespace and therefore be accessible in the parent namespace for further reactivity.
I propose (and would be happy to PR) a
golem::add_pseudo_module
if we think this is functionality that would be useful to have in thegolem
package?ns_find
currently usesstringr
,purrr
andUU
but these functions could be substituted such thatgolem
doesn't need any additional dependencies if that is preferred?@VincentGuyader @ColinFay
The text was updated successfully, but these errors were encountered: