Skip to content

Commit

Permalink
fix: prevent access-before-initialisation storybook errors (#414)
Browse files Browse the repository at this point in the history
* fix: stop importing from index files

* chore(yarn): update yarn.lock

* fix(sharing-dialog): stop importing from @dhis2/ui

Co-authored-by: ismay <[email protected]>
  • Loading branch information
HendrikThePendric and ismay committed Dec 16, 2020
1 parent 76e7154 commit 9e325c3
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/widgets/src/SharingDialog/AccessSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react'
import PropTypes from '@dhis2/prop-types'
import i18n from '@dhis2/d2-i18n'

import { MenuDivider, MenuItem } from '@dhis2/ui'
import { SingleSelectField } from '../index.js'
import { MenuDivider, MenuItem } from '@dhis2/ui-core'
import { SingleSelectField } from '../SingleSelectField/SingleSelectField.js'

import { accessStrings } from './sharingConstants'
import { accessSelectStyles } from './SharingDialog.styles'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { createRef, useState, useEffect } from 'react'
import PropTypes from '@dhis2/prop-types'

import { Menu, MenuItem } from '@dhis2/ui'
import { Menu, MenuItem } from '@dhis2/ui-core'

import { InputField } from '../../'
import { InputField } from '../../InputField/InputField.js'
import { MenuWrapper } from './MenuWrapper'

// Keycodes for the keypress event handlers
Expand Down
6 changes: 3 additions & 3 deletions packages/widgets/src/SharingDialog/ShareBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import i18n from '@dhis2/d2-i18n'
import { useDataQuery } from '@dhis2/app-runtime'
import { Button, Divider } from '@dhis2/ui-core'

import { ACCESS_VIEW_ONLY, ACCESS_VIEW_AND_EDIT } from './sharingConstants'
import { Autocomplete } from './Autocomplete/Autocomplete'
import { AccessSelect } from './AccessSelect'
import { ACCESS_VIEW_ONLY, ACCESS_VIEW_AND_EDIT } from './sharingConstants.js'
import { Autocomplete } from './Autocomplete/Autocomplete.js'
import { AccessSelect } from './AccessSelect.js'
import { sharingCommonStyles, shareBlockStyles } from './SharingDialog.styles'

import { debounce } from './helpers'
Expand Down
6 changes: 3 additions & 3 deletions packages/widgets/src/SharingDialog/SharingDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
ButtonStrip,
Button,
} from '@dhis2/ui-core'
import { SharingList } from './SharingList'
import { ShareBlock } from './ShareBlock'
import { SharingList } from './SharingList.js'
import { ShareBlock } from './ShareBlock.js'
import {
defaultSharingSettings,
convertAccessToConstant,
convertConstantToAccess,
} from './sharingConstants'
} from './sharingConstants.js'

const query = {
sharing: {
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/SharingDialog/SharingList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

import PropTypes from '@dhis2/prop-types'
import i18n from '@dhis2/d2-i18n'
import { Divider } from '@dhis2/ui'
import { Divider } from '@dhis2/ui-core'

import { sharingCommonStyles, sharingListStyles } from './SharingDialog.styles'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/SharingDialog/SharingListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from '@dhis2/prop-types'

import i18n from '@dhis2/d2-i18n'
import { Divider } from '@dhis2/ui'
import { Divider } from '@dhis2/ui-core'

import { sharingListItemStyles } from './SharingDialog.styles'
import { World as WorldIcon } from './icons/World'
Expand Down
65 changes: 51 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,21 @@
dependencies:
"@babel/types" "^7.10.4"

"@babel/helper-annotate-as-pure@^7.12.10":
version "7.12.10"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.10.tgz#54ab9b000e60a93644ce17b3f37d313aaf1d115d"
integrity sha512-XplmVbC1n+KY6jL8/fgLVXXUauDIB+lD5+GsQEh6F6GBF1dq1qy4DP4yXWzDKcoqXB3X58t61e85Fitoww4JVQ==
dependencies:
"@babel/types" "^7.12.10"

"@babel/helper-annotate-as-pure@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee"
integrity sha512-6o+mJrZBxOoEX77Ezv9zwW7WV8DdluouRKNY/IR5u/YTMuKHgugHOzYWlYvYLpLA9nPsQCAAASpCIbjI9Mv+Uw==
dependencies:
"@babel/types" "^7.8.3"

"@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4":
"@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4", "@babel/helper-builder-binary-assignment-operator-visitor@^7.8.3":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz#bb0b75f31bf98cbf9ff143c1ae578b87274ae1a3"
integrity sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg==
Expand All @@ -140,7 +147,16 @@
"@babel/helper-module-imports" "^7.12.1"
"@babel/types" "^7.12.1"

"@babel/helper-builder-react-jsx@^7.10.4":
"@babel/helper-builder-react-jsx-experimental@^7.9.0":
version "7.12.10"
resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.12.10.tgz#a58cb96a793dc0fcd5c9ed3bb36d62fdc60534c2"
integrity sha512-3Kcr2LGpL7CTRDTTYm1bzeor9qZbxbvU2AxsLA6mUG9gYarSfIKMK0UlU+azLWI+s0+BH768bwyaziWB2NOJlQ==
dependencies:
"@babel/helper-annotate-as-pure" "^7.12.10"
"@babel/helper-module-imports" "^7.12.5"
"@babel/types" "^7.12.10"

"@babel/helper-builder-react-jsx@^7.10.4", "@babel/helper-builder-react-jsx@^7.9.0":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.10.4.tgz#8095cddbff858e6fa9c326daee54a2f2732c1d5d"
integrity sha512-5nPcIZ7+KKDxT1427oBivl9V9YTal7qk0diccnh7RrcgrT/pGFOjgGw1dgryyx1GvHEpXVfoDF6Ak3rTiWh8Rg==
Expand Down Expand Up @@ -199,7 +215,7 @@
"@babel/helper-regex" "^7.8.3"
regexpu-core "^4.7.0"

"@babel/helper-define-map@^7.10.4":
"@babel/helper-define-map@^7.10.4", "@babel/helper-define-map@^7.8.3":
version "7.10.5"
resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz#b53c10db78a640800152692b13393147acb9bb30"
integrity sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==
Expand Down Expand Up @@ -247,7 +263,7 @@
dependencies:
"@babel/types" "^7.8.3"

"@babel/helper-hoist-variables@^7.10.4":
"@babel/helper-hoist-variables@^7.10.4", "@babel/helper-hoist-variables@^7.8.3":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz#d49b001d1d5a68ca5e6604dda01a6297f7c9381e"
integrity sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA==
Expand Down Expand Up @@ -275,14 +291,14 @@
dependencies:
"@babel/types" "^7.8.3"

"@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.5":
"@babel/helper-module-imports@^7.12.1", "@babel/helper-module-imports@^7.12.5", "@babel/helper-module-imports@^7.8.3":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz#1bfc0229f794988f76ed0a4d4e90860850b54dfb"
integrity sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==
dependencies:
"@babel/types" "^7.12.5"

"@babel/helper-module-transforms@^7.12.1":
"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.9.0":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c"
integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==
Expand Down Expand Up @@ -335,7 +351,7 @@
dependencies:
lodash "^4.17.13"

"@babel/helper-remap-async-to-generator@^7.12.1":
"@babel/helper-remap-async-to-generator@^7.12.1", "@babel/helper-remap-async-to-generator@^7.8.3":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.1.tgz#8c4dbbf916314f6047dc05e6a2217074238347fd"
integrity sha512-9d0KQCRM8clMPcDwo8SevNs+/9a8yWVVmaE80FGJcEP8N1qToREmWEGnBn8BUlJhYRFz6fqxeRL1sl5Ogsed7A==
Expand All @@ -344,7 +360,7 @@
"@babel/helper-wrap-function" "^7.10.4"
"@babel/types" "^7.12.1"

"@babel/helper-replace-supers@^7.12.1":
"@babel/helper-replace-supers@^7.12.1", "@babel/helper-replace-supers@^7.8.3":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz#f009a17543bbbbce16b06206ae73b63d3fca68d9"
integrity sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==
Expand All @@ -364,7 +380,7 @@
"@babel/traverse" "^7.8.6"
"@babel/types" "^7.8.6"

"@babel/helper-simple-access@^7.12.1":
"@babel/helper-simple-access@^7.12.1", "@babel/helper-simple-access@^7.8.3":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136"
integrity sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==
Expand Down Expand Up @@ -674,6 +690,7 @@
"@babel/helper-plugin-utils" "^7.8.0"

"@babel/plugin-syntax-bigint@^7.8.3", "@babel/plugin-syntax-class-properties@^7.8.3":
name "@babel/plugin-syntax-class-properties"
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea"
integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==
Expand Down Expand Up @@ -736,7 +753,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"

"@babel/plugin-syntax-jsx@^7.12.1":
"@babel/plugin-syntax-jsx@^7.12.1", "@babel/plugin-syntax-jsx@^7.8.3":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.1.tgz#9d9d357cc818aa7ae7935917c1257f67677a0926"
integrity sha512-1yRi7yAtB0ETgxdY9ti/p2TivUxJkTdhu/ZbF9MshVGqOx1TdB3b7xCXs49Fupgg50N45KcAsRP/ZqWjs9SRjg==
Expand Down Expand Up @@ -1427,7 +1444,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.3"

"@babel/plugin-transform-typescript@^7.12.1":
"@babel/plugin-transform-typescript@^7.12.1", "@babel/plugin-transform-typescript@^7.9.0":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.12.1.tgz#d92cc0af504d510e26a754a7dbc2e5c8cd9c7ab4"
integrity sha512-VrsBByqAIntM+EYMqSm59SiMEf7qkmI9dqMt6RbD/wlwueWmYcI0FFK5Fj47pP6DRZm+3teXjosKlwcZJ5lIMw==
Expand Down Expand Up @@ -1909,7 +1926,7 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"

"@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0":
"@babel/types@^7.12.10", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0":
version "7.12.10"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.10.tgz#7965e4a7260b26f09c56bcfcb0498af1f6d9b260"
integrity sha512-sf6wboJV5mGyip2hIpDSKsr80RszPinEFjsHTalMxZAZkoQ2/2yQzxlcFN52SJqsyPfLtPmenL4g2KB3KJXPDw==
Expand Down Expand Up @@ -5021,6 +5038,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.10.1.tgz#f52fca9715579a14f841d67d7f8d25432ab6a3dd"
integrity sha512-UY7+9DPzlJ9VM8eY0b2TUZcZvF+1pO0hzMtAyjBYKhOmnvRlqYNYnWdtsMj0V16CGaMlpL0G1jnLbLo4AyotuQ==

[email protected]:
version "0.11.3"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.3.tgz#c20757fe72ee71278ea0ff3d87e5c2ca30d9edf8"
integrity sha512-XA5o5dsNw8MhyW0Q7MWXJWc4oOzZKbdsEJq45h7c8q/d9DwWZ5F2ugUc1PuMLPGsUnphCt/cNDHu8JeBbxf1qA==

ast-types@^0.14.2:
version "0.14.2"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.14.2.tgz#600b882df8583e3cd4f2df5fa20fa83759d4bdfd"
Expand Down Expand Up @@ -5243,7 +5265,7 @@ babel-plugin-add-react-displayname@^0.0.5:
resolved "https://registry.yarnpkg.com/babel-plugin-add-react-displayname/-/babel-plugin-add-react-displayname-0.0.5.tgz#339d4cddb7b65fd62d1df9db9fe04de134122bd5"
integrity sha1-M51M3be2X9YtHfnbn+BN4TQSK9U=

babel-plugin-dynamic-import-node@^2.3.3:
babel-plugin-dynamic-import-node@^2.3.0, babel-plugin-dynamic-import-node@^2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3"
integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==
Expand Down Expand Up @@ -9068,7 +9090,7 @@ esrecurse@^4.3.0:
dependencies:
estraverse "^5.2.0"

estraverse@^4.1.1, estraverse@^4.2.0:
estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
Expand Down Expand Up @@ -13646,6 +13668,11 @@ miller-rabin@^4.0.0:
bn.js "^4.0.0"
brorand "^1.0.1"

[email protected]:
version "1.43.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58"
integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==

[email protected]:
version "1.44.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92"
Expand Down Expand Up @@ -16670,6 +16697,16 @@ recast@^0.12.6:
private "~0.1.5"
source-map "~0.6.1"

recast@^0.14.7:
version "0.14.7"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.14.7.tgz#4f1497c2b5826d42a66e8e3c9d80c512983ff61d"
integrity sha512-/nwm9pkrcWagN40JeJhkPaRxiHXBRkXyRh/hgU088Z/v+qCy+zIHHY6bC6o7NaKAxPqtE6nD8zBH1LfU0/Wx6A==
dependencies:
ast-types "0.11.3"
esprima "~4.0.0"
private "~0.1.5"
source-map "~0.6.1"

rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
Expand Down

0 comments on commit 9e325c3

Please sign in to comment.