After an element has been rendered using findAndRenderReactData() the element is unbound.
Questions
It works based on assumption that Shiny binds new component immediately after ReactDOM.render is called. Is it possible that we will unbind input before it has been bound by Shiny (resulting in no effect)?
Scenario: uiOutput
uiOutput itself binds inputs each time inputs are added to DOM. Mutation observer watches changes in nodes those nodes and removes bindings from React inputs.
Questions
Do we want to modify behavior of uiOutput? Maybe we'd like to only use React components using reactOutput and keep uiOutput unchanged as it's the expected behavior there that it binds all inputs within?
Test case
Comment out line 24 in adapters.js to test that React components don't set input values anymore. Without the changes from this PR values are set even without explicit ShinyProxy.setInputValue(inputId, value); call in the useValue effect.
46
Changes description
Scenarios: static rendering,
reactOutput
After an element has been rendered using
findAndRenderReactData()
the element is unbound.Questions
It works based on assumption that Shiny binds new component immediately after
ReactDOM.render
is called. Is it possible that we will unbind input before it has been bound by Shiny (resulting in no effect)?Scenario:
uiOutput
uiOutput
itself binds inputs each time inputs are added to DOM. Mutation observer watches changes in nodes those nodes and removes bindings from React inputs.Questions
Do we want to modify behavior of
uiOutput
? Maybe we'd like to only use React components usingreactOutput
and keepuiOutput
unchanged as it's the expected behavior there that it binds all inputs within?Test case
Comment out line 24 in
adapters.js
to test that React components don't set input values anymore. Without the changes from this PR values are set even without explicitShinyProxy.setInputValue(inputId, value);
call in theuseValue
effect.Definition of Done checklist