Skip to content

Commit

Permalink
Merge #505
Browse files Browse the repository at this point in the history
505: build(deps): bump React to v18 r=mdubus a=mdubus

# Pull Request

## What does this PR do?
Bump React to its latest version

⚠️ Please wait for `@nicolasvienot` 's review before merging it 🙏

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: Morgane Dubus <[email protected]>
  • Loading branch information
meili-bors[bot] and mdubus authored May 14, 2024
2 parents b5243b8 + 78570c8 commit 2f4e5d0
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 131 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"react/no-arrow-function-lifecycle": 0,
"react/no-invalid-html-attribute": 0,
"react/jsx-no-useless-fragment": "off",
"react/no-unused-class-component-methods": 0
"react/no-unused-class-component-methods": 0,
"react/require-default-props": "off"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"eslint-plugin-import": "^2.29.1",
"meilisearch": "^0.38.0",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-instantsearch-dom": "^6.40.4",
"react-json-view": "^1.21.3",
"react-lazy-load-image-component": "^1.6.0",
Expand Down
17 changes: 10 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,17 @@ const App = () => {
)
}, [apiKey])

useEffect(async () => {
const isInstanceRunning = await meilisearchJsClient.isHealthy()
setIsMeilisearchRunning(isInstanceRunning)
if (isInstanceRunning) {
setRequireApiKeyToWork(await hasAnApiKeySet())
dialog.setVisible(await shouldDisplayApiKeyModal(meilisearchJsClient))
getIndexesList()
useEffect(() => {
const onClientUpdate = async () => {
const isInstanceRunning = await meilisearchJsClient.isHealthy()
setIsMeilisearchRunning(isInstanceRunning)
if (isInstanceRunning) {
setRequireApiKeyToWork(await hasAnApiKeySet())
dialog.setVisible(await shouldDisplayApiKeyModal(meilisearchJsClient))
getIndexesList()
}
}
onClientUpdate()
}, [meilisearchJsClient])

return (
Expand Down
9 changes: 0 additions & 9 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,4 @@ Button.propTypes = {
children: PropTypes.node,
}

Button.defaultProps = {
as: null,
variant: 'default',
size: 'medium',
icon: null,
toggable: false,
children: null,
}

export default Button
4 changes: 0 additions & 4 deletions src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ Card.propTypes = {
children: PropTypes.node,
}

Card.defaultProps = {
children: null,
}

export default Card
4 changes: 0 additions & 4 deletions src/components/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@ Container.propTypes = {
children: PropTypes.node,
}

Container.defaultProps = {
children: null,
}

export default Container
5 changes: 0 additions & 5 deletions src/components/EmptyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,4 @@ EmptyView.propTypes = {
children: PropTypes.node,
}

EmptyView.defaultProps = {
buttonLink: null,
children: null,
}

export default EmptyView
17 changes: 10 additions & 7 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@ const Header = ({
const { meilisearchJsClient } = useMeilisearchClientContext()
const [version, setVersion] = React.useState()

React.useEffect(async () => {
try {
const res = await meilisearchJsClient.getVersion()
setVersion(res.pkgVersion)
} catch (err) {
// eslint-disable-next-line no-console
console.log(err)
React.useEffect(() => {
const getMeilisearchVersion = async () => {
try {
const res = await meilisearchJsClient.getVersion()
setVersion(res.pkgVersion)
} catch (err) {
// eslint-disable-next-line no-console
console.log(err)
}
}
getMeilisearchVersion()
}, [meilisearchJsClient])

return (
Expand Down
8 changes: 1 addition & 7 deletions src/components/IconButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const StyledButton = styled.button`
`

const IconButton = React.forwardRef(
({ color: iconColor, variant, children, ...props }, ref) => {
({ color: iconColor, variant = 'default', children, ...props }, ref) => {
const safeVariant = variants[variant] || variants.default

return (
Expand Down Expand Up @@ -84,10 +84,4 @@ IconButton.propTypes = {
children: PropTypes.node,
}

IconButton.defaultProps = {
color: null,
variant: 'default',
children: null,
}

export default IconButton
4 changes: 0 additions & 4 deletions src/components/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,3 @@ Input.propTypes = {
*/
icon: PropTypes.node,
}

Input.defaultProps = {
icon: null,
}
6 changes: 0 additions & 6 deletions src/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,4 @@ Link.propTypes = {
children: PropTypes.node,
}

Link.defaultProps = {
href: null,
target: '_blank',
children: null,
}

export default Link
5 changes: 0 additions & 5 deletions src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,4 @@ Modal.propTypes = {
children: PropTypes.node,
}

Modal.defaultProps = {
title: null,
children: null,
}

export default Modal
7 changes: 5 additions & 2 deletions src/components/Results/InfiniteHits.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ const findImageKey = async (array) => {
const InfiniteHits = connectInfiniteHits(({ hits, hasMore, refineNext }) => {
const [imageKey, setImageKey] = React.useState(false)

React.useEffect(async () => {
setImageKey(hits[0] ? await findImageKey(Object.entries(hits[0])) : null)
React.useEffect(() => {
const getImageKey = async () => {
setImageKey(hits[0] ? await findImageKey(Object.entries(hits[0])) : null)
}
getImageKey()
}, [hits[0]])
// ({ hits, hasMore, refineNext, mode }) => {
return (
Expand Down
8 changes: 0 additions & 8 deletions src/components/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,4 @@ Select.propTypes = {
noOptionComponent: PropTypes.node,
}

Select.defaultProps = {
options: null,
icon: null,
currentOption: null,
onChange: null,
noOptionComponent: null,
}

export default Select
9 changes: 1 addition & 8 deletions src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const DisclosureContent = styled(ReakitDisclosureContent)`
`

const Sidebar = ({
sidebarIcon,
sidebarIcon = <Arrow style={{ transform: 'rotate(270deg)' }} />,
visible = true,
onChange = () => {},
children,
Expand Down Expand Up @@ -156,11 +156,4 @@ Sidebar.propTypes = {
children: PropTypes.node,
}

Sidebar.defaultProps = {
sidebarIcon: <Arrow style={{ transform: 'rotate(270deg)' }} />,
visible: true,
onChange: null,
children: null,
}

export default Sidebar
6 changes: 0 additions & 6 deletions src/components/Stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,4 @@ Stats.propTypes = {
nbResults: PropTypes.number,
}

Stats.defaultProps = {
nbHits: null,
processingTimeMS: null,
nbResults: null,
}

export default Stats
8 changes: 0 additions & 8 deletions src/components/Toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,4 @@ Toggle.propTypes = {
initialValue: PropTypes.bool,
}

Toggle.defaultProps = {
onLabel: 'On',
offLabel: 'Off',
ariaLabel: null,
onChange: null,
initialValue: true,
}

export default Toggle
9 changes: 2 additions & 7 deletions src/components/Typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ const StyledTypography = styled.span`

const Typography = ({ variant = 'default', children, ...props }) => {
const safeVariant = variants[variant] || variants.default
const { tag = 'span', style = css`` } = safeVariant
const { tag = 'span' } = safeVariant
return (
<StyledTypography as={tag} {...style} $variant={safeVariant} {...props}>
<StyledTypography as={tag} $variant={safeVariant} {...props}>
{children}
</StyledTypography>
)
Expand Down Expand Up @@ -183,9 +183,4 @@ Typography.propTypes = {
children: PropTypes.node,
}

Typography.defaultProps = {
variant: 'default',
children: null,
}

export default Typography
9 changes: 5 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { createRoot } from 'react-dom/client'
import { ThemeProvider } from 'styled-components'

import theme from 'theme'
import App from 'App'
import GlobalStyle from 'GlobalStyle'
import { MeiliSearchClientProvider } from 'context/MeilisearchClientContext'

ReactDOM.render(
const container = document.getElementById('root')
const root = createRoot(container)
root.render(
<MeiliSearchClientProvider>
<ThemeProvider theme={theme}>
<GlobalStyle />
<App />
</ThemeProvider>
</MeiliSearchClientProvider>,
document.getElementById('root')
</MeiliSearchClientProvider>
)
29 changes: 2 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12820,23 +12820,14 @@ react-docgen@^7.0.0:
resolve "^1.22.1"
strip-indent "^4.0.0"

"react-dom@^16.8.0 || ^17.0.0 || ^18.0.0":
"react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", react-dom@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4"
integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==
dependencies:
loose-envify "^1.1.0"
scheduler "^0.23.2"

react-dom@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler "^0.20.2"

react-element-to-jsx-string@^15.0.0:
version "15.0.0"
resolved "https://registry.yarnpkg.com/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz#1cafd5b6ad41946ffc8755e254da3fc752a01ac6"
Expand Down Expand Up @@ -12990,21 +12981,13 @@ react-textarea-autosize@^8.3.2:
use-composed-ref "^1.0.0"
use-latest "^1.0.0"

"react@^16.8.0 || ^17.0.0 || ^18.0.0":
"react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
dependencies:
loose-envify "^1.1.0"

react@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

read-cache@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
Expand Down Expand Up @@ -13517,14 +13500,6 @@ saxes@^5.0.1:
dependencies:
xmlchars "^2.2.0"

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

scheduler@^0.23.2:
version "0.23.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3"
Expand Down

0 comments on commit 2f4e5d0

Please sign in to comment.