Bug #20328

mounting react component twice doesn't work consistently

Added by Ohad Levy 12 months ago. Updated 7 days ago.

Assignee:Ohad Levy
Category:JavaScript stack
Target version:1.16.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link: Found in Releases:
Pull request:https://github.com/theforeman/foreman/pull/4680


When using the react mounter (https://github.com/theforeman/foreman/blob/develop/webpack/assets/javascripts/react_app/common/MountingService.js) and somehow (usually via ajax) mount a component into an existing div (that already have a react on it), the portion showed on the screen will differ based on how the top level mounted component is implemented (e.g. some will read the state from the store, others will reinit it etc).

I would suggest that since this is usually a side effect of using react via ajax (e.g. compute resource vm tab is reloaded because you selected a different org) we should default to clearing the react component div prior to remounting it.

Associated revisions

Revision 9cfb8e31
Added by Ohad Levy 12 months ago

fixes #20328 - ensure target div is always empty

this solves the problem when a div has already react component on it,
which gets reloaded via some ajax call.


#1 Updated by The Foreman Bot 12 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4680 added

#2 Updated by Daniel Lobato Garcia 12 months ago

  • Legacy Backlogs Release (now unused) set to 240

#3 Updated by Ohad Levy 12 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF