@codeleap/web 3.22.1 → 3.22.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/web",
3
- "version": "3.22.1",
3
+ "version": "3.22.2",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -386,6 +386,10 @@ export const Modal = (props) => {
386
386
  setIndex(visible, modalId.current)
387
387
  }, visible ? 0 : 500)
388
388
  }
389
+
390
+ return () => {
391
+ if (scrollLock) modalScrollLock(false, modalId.current)
392
+ }
389
393
  }, [visible])
390
394
 
391
395
  const content = <ModalContent {...props} visible={visible} toggle={toggle} id={modalId.current} />
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react'
3
3
  import React, { useRef, forwardRef, useImperativeHandle } from 'react'
4
- import { FormTypes, useValidate, useState, TypeGuards, onUpdate, IconPlaceholder } from '@codeleap/common'
4
+ import { FormTypes, useValidate, useState, TypeGuards, onUpdate, IconPlaceholder, useEffect } from '@codeleap/common'
5
5
  import _Select, { components, MenuListProps, MenuProps, MultiValueProps, NoticeProps } from 'react-select'
6
6
  import Async from 'react-select/async'
7
7
  import { useSelectStyles } from './styles'
@@ -241,6 +241,12 @@ export const Select = forwardRef<HTMLInputElement, SelectProps>(
241
241
 
242
242
  const [selectedOption, setSelectedOption] = hasSelectedOptionState ? [_selectedOption, _setSelectedOption] : useState(initialValue ?? value)
243
243
 
244
+ useEffect(() => {
245
+ if (loadInitialValue && !selectedOption && !!initialValue) {
246
+ setSelectedOption(initialValue)
247
+ }
248
+ }, [!!initialValue])
249
+
244
250
  const [_isFocused, setIsFocused] = useState(false)
245
251
  const [loadedOptions, setLoadedOptions] = useState(false)
246
252
  const [keyDownActive, setKeyDownActive] = useState(false)