Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update react 18 #187

Merged
merged 6 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const nextConfig = {

const withTM = require("next-transpile-modules")([
"@cloudscape-design/components",
"@cloudscape-design/component-toolkit",
"@cloudscape-design/design-tokens"
]);

Expand Down
518 changes: 266 additions & 252 deletions frontend/package-lock.json
mtfranchetto marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"private": true,
"homepage": "/",
"dependencies": {
"@cloudscape-design/components": "^3.0.118",
"@cloudscape-design/design-tokens": "^3.0.9",
"@cloudscape-design/global-styles": "^1.0.2",
"@cloudscape-design/components": "^3.0.248",
"@cloudscape-design/design-tokens": "^3.0.11",
"@cloudscape-design/global-styles": "^1.0.8",
"@reduxjs/toolkit": "^1.6.1",
"axios": "^0.21.4",
"i18next": "^21.8.13",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"next": "^12.2.0",
"next-transpile-modules": "^9.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^11.18.0",
"react-query": "^3.39.1",
"react-redux": "^7.2.5",
Expand Down Expand Up @@ -47,9 +47,8 @@
},
"devDependencies": {
"@cloudscape-design/jest-preset": "^2.0.4",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.3.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^28.1.4",
"@types/lodash": "^4.14.182",
"@types/node": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/__tests__/useClusterPoll.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {renderHook} from '@testing-library/react-hooks'
import {renderHook} from '@testing-library/react'
import {useClusterPoll} from '../useClusterPoll'

jest.mock('../../model', () => ({
Expand Down
32 changes: 8 additions & 24 deletions frontend/src/components/__tests__/useLoadingState.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {renderHook} from '@testing-library/react-hooks'
import {renderHook, waitFor} from '@testing-library/react'
import {useLoadingState} from '../useLoadingState'
import {Box} from '@cloudscape-design/components'
import React from 'react'
Expand Down Expand Up @@ -44,9 +44,9 @@ jest.mock('../../model', () => {
})

function expectDataToBeRequested() {
expect(mockGetAppConfig).toHaveBeenCalledTimes(1)
expect(mockGetIdentity).toHaveBeenCalledTimes(1)
expect(mockGetVersion).toHaveBeenCalledTimes(1)
waitFor(() => expect(mockGetAppConfig).toHaveBeenCalledTimes(1))
waitFor(() => expect(mockGetIdentity).toHaveBeenCalledTimes(1))
waitFor(() => expect(mockGetVersion).toHaveBeenCalledTimes(1))
}

function expectDataNotToBeRequested() {
Expand Down Expand Up @@ -114,12 +114,7 @@ describe('given a hook to load all the data necessary for the app to boot', () =
})

it('should request the data', async () => {
const {waitForNextUpdate} = renderHook(
() => useLoadingState(<Box></Box>),
{wrapper},
)

await waitForNextUpdate()
renderHook(() => useLoadingState(<Box></Box>), {wrapper})

expectDataToBeRequested()
})
Expand All @@ -139,12 +134,7 @@ describe('given a hook to load all the data necessary for the app to boot', () =
})

it('should request the data', async () => {
const {waitForNextUpdate} = renderHook(
() => useLoadingState(<Box></Box>),
{wrapper},
)

await waitForNextUpdate()
renderHook(() => useLoadingState(<Box></Box>), {wrapper})

expectDataToBeRequested()
})
Expand All @@ -166,12 +156,7 @@ describe('given a hook to load all the data necessary for the app to boot', () =
})

it('should request the data', async () => {
const {waitForNextUpdate} = renderHook(
() => useLoadingState(<Box></Box>),
{wrapper},
)

await waitForNextUpdate()
renderHook(() => useLoadingState(<Box></Box>), {wrapper})

expectDataToBeRequested()
})
Expand Down Expand Up @@ -259,10 +244,9 @@ describe('given a hook to load all the data necessary for the app to boot', () =
done()
})

const {waitForNextUpdate} = renderHook(() => useLoadingState(<></>), {
renderHook(() => useLoadingState(<></>), {
wrapper,
})
waitForNextUpdate()
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
// limitations under the License.

import {renderHook} from '@testing-library/react-hooks'
import {renderHook} from '@testing-library/react'
import {useFeatureFlag} from '../useFeatureFlag'

const mockUseState = jest.fn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// limitations under the License.

import {Store} from '@reduxjs/toolkit'
import {renderHook} from '@testing-library/react-hooks'
import {renderHook} from '@testing-library/react'
import {mock} from 'jest-mock-extended'
import {PropsWithChildren} from 'react'
import {Provider} from 'react-redux'
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/old-pages/Configure/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {setState, getState, useState} from '../../store'
import {NavigateFunction} from 'react-router-dom'
import TitleDescriptionHelpPanel from '../../components/help-panel/TitleDescriptionHelpPanel'
import {useHelpPanel} from '../../components/help-panel/HelpPanel'
import {StackedFlashbarProps} from '@cloudscape-design/components/flashbar/interfaces'
import {errorsToFlashbarItems} from './errorsToFlashbarItems'

// Constants
Expand Down Expand Up @@ -209,7 +208,7 @@ function Create() {
FlashbarProps.MessageDefinition[]
>([])

const flashbarProps: StackedFlashbarProps = {
const flashbarProps: FlashbarProps = {
stackItems: true,
items: flashbarItems,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Store} from '@reduxjs/toolkit'
import {renderHook} from '@testing-library/react-hooks'
import {renderHook} from '@testing-library/react'
import {mock} from 'jest-mock-extended'
import {Provider} from 'react-redux'
import {useDynamicStorage} from '../Storage'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Store} from '@reduxjs/toolkit'
import {renderHook} from '@testing-library/react-hooks'
import {renderHook} from '@testing-library/react'
import {mock} from 'jest-mock-extended'
import {Provider} from 'react-redux'
import {useWizardNavigation} from '../useWizardNavigation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// limitations under the License.

import {Store} from '@reduxjs/toolkit'
import {render, RenderResult} from '@testing-library/react'
import {render, RenderResult, waitFor} from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import {mock} from 'jest-mock-extended'
import {I18nextProvider, initReactI18next} from 'react-i18next'
Expand Down Expand Up @@ -142,7 +142,7 @@ describe('given a component to show the log streams list and a cluster name', ()

describe('when the user selects a log stream', () => {
it('should call the selection handler with the selected log stream name', async () => {
await userEvent.click(screen.getByRole('radio'))
await waitFor(() => userEvent.click(screen.getByRole('radio')))
expect(mockOnLogStreamSelect).toHaveBeenCalledTimes(1)
expect(mockOnLogStreamSelect).toHaveBeenCalledWith(
'hostname.instanceId.logIdentifier',
Expand Down