@mackin.com/styleguide 7.12.0 → 7.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +4 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1049,9 +1049,6 @@ const BackdropContextProvider = (p) => {
1049
1049
  log('un-mounted');
1050
1050
  };
1051
1051
  }, []);
1052
- React.useEffect(() => {
1053
- log('re-rendered');
1054
- });
1055
1052
  React.useEffect(() => {
1056
1053
  log('showCount changed', showCount);
1057
1054
  }, [showCount]);
@@ -1105,9 +1102,6 @@ const BackdropOverlay = (p) => {
1105
1102
  log('unmounted');
1106
1103
  };
1107
1104
  }, []);
1108
- React.useEffect(() => {
1109
- log('re-rendered');
1110
- });
1111
1105
  React.useEffect(() => {
1112
1106
  log('context.showing changed', context.showing);
1113
1107
  }, [context.showing]);
@@ -1337,13 +1331,14 @@ const Modal = (p) => {
1337
1331
  const hasHeader = p.closeButton || p.heading;
1338
1332
  const contentRef = React__default['default'].useRef(null);
1339
1333
  const log = useLogger(`Modal ${(_a = p.id) !== null && _a !== void 0 ? _a : '?'}`, (_b = p.debug) !== null && _b !== void 0 ? _b : false);
1334
+ const showing = React.useRef(p.show);
1340
1335
  React.useEffect(() => {
1341
1336
  log('mounted');
1342
1337
  return () => {
1343
1338
  // handle the use of modals that are rendered only as show=true and then unmounted.
1344
1339
  backdrop.setShow(false);
1345
1340
  log('backdrop.setShow', false);
1346
- if (backdrop.showCount <= 1 && htmlBodyStyles) {
1341
+ if (showing.current && backdrop.showCount <= 1 && htmlBodyStyles) {
1347
1342
  log('backdrop.showCount', backdrop.showCount, 'removing htmlBodyStyles');
1348
1343
  document.body.classList.remove(htmlBodyStyles);
1349
1344
  }
@@ -1353,10 +1348,12 @@ const Modal = (p) => {
1353
1348
  React.useEffect(() => {
1354
1349
  log('show changed', p.show);
1355
1350
  backdrop.setShow(p.show);
1351
+ showing.current = p.show;
1356
1352
  log('backdrop.setShow', true);
1357
1353
  if (!htmlBodyStyles) {
1358
1354
  log('creating singleton htmlBodyStyles');
1359
1355
  htmlBodyStyles = css.css({
1356
+ label: 'ModalBodyOverrides',
1360
1357
  overflow: 'hidden',
1361
1358
  paddingRight: `${useScrollbarSize()}px`
1362
1359
  });
@@ -3787,9 +3784,6 @@ const WaitingIndicator = (p) => {
3787
3784
  log('unmounted');
3788
3785
  };
3789
3786
  }, []);
3790
- React.useEffect(() => {
3791
- log('re-rendered');
3792
- });
3793
3787
  }
3794
3788
  React.useEffect(() => {
3795
3789
  log('show changed', p.show);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.12.0",
3
+ "version": "7.12.1",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",