-
Notifications
You must be signed in to change notification settings - Fork 365
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
refactor: [M3-7960] - Update Notistack to 3.0.1
#10357
Changes from all commits
c44f5b2
989f82e
ba32d51
a6d10e2
ac581c6
ca55973
196167d
3522d94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
Update Notistack to 3.0.1 ([#10357](https://github.com/linode/manager/pull/10357)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import { APIError } from '@linode/api-v4/lib/types'; | |
import { vpcsValidateIP } from '@linode/validation'; | ||
import { CreateLinodeSchema } from '@linode/validation/lib/linodes.schema'; | ||
import Grid from '@mui/material/Unstable_Grid2'; | ||
import { WithSnackbarProps, withSnackbar } from 'notistack'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In short:
CC @bnussman-akamai for Linode Create v2, tho I guess you handle this already the right way, or will |
||
import { enqueueSnackbar } from 'notistack'; | ||
import * as React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
|
@@ -63,11 +63,11 @@ import { | |
} from 'src/utilities/analytics'; | ||
import { getAPIErrorOrDefault } from 'src/utilities/errorUtils'; | ||
import { ExtendedType, extendType } from 'src/utilities/extendType'; | ||
import { isEURegion } from 'src/utilities/formatRegion'; | ||
import { | ||
getGDPRDetails, | ||
getSelectedRegionGroup, | ||
} from 'src/utilities/formatRegion'; | ||
import { isEURegion } from 'src/utilities/formatRegion'; | ||
import { ExtendedIP } from 'src/utilities/ipUtils'; | ||
import { UNKNOWN_PRICE } from 'src/utilities/pricing/constants'; | ||
import { getLinodeRegionPrice } from 'src/utilities/pricing/linodes'; | ||
|
@@ -127,8 +127,7 @@ interface State { | |
vpcIPv4AddressOfLinode?: string; | ||
} | ||
|
||
type CombinedProps = WithSnackbarProps & | ||
CreateType & | ||
type CombinedProps = CreateType & | ||
WithImagesProps & | ||
WithTypesProps & | ||
WithLinodesProps & | ||
|
@@ -896,12 +895,9 @@ class LinodeCreateContainer extends React.PureComponent<CombinedProps, State> { | |
); | ||
|
||
/** show toast */ | ||
this.props.enqueueSnackbar( | ||
`Your Linode ${response.label} is being created.`, | ||
{ | ||
variant: 'success', | ||
} | ||
); | ||
enqueueSnackbar(`Your Linode ${response.label} is being created.`, { | ||
variant: 'success', | ||
}); | ||
|
||
/** reset the Events polling */ | ||
this.props.checkForNewEvents(); | ||
|
@@ -977,7 +973,6 @@ export default recompose<CombinedProps, {}>( | |
withRegions, | ||
withTypes, | ||
connected, | ||
withSnackbar, | ||
withFeatureFlags, | ||
withProfile, | ||
withAgreements, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import { | |
useAllPlacementGroupsQuery, | ||
useAssignLinodesToPlacementGroup, | ||
} from 'src/queries/placementGroups'; | ||
import { getErrorStringOrDefault } from 'src/utilities/errorUtils'; | ||
|
||
import { LinodeSelect } from '../Linodes/LinodeSelect/LinodeSelect'; | ||
import { | ||
|
@@ -126,13 +127,13 @@ export const PlacementGroupsAssignLinodesDrawer = ( | |
variant: 'success', | ||
}); | ||
handleDrawerClose(); | ||
} catch (error) { | ||
setGeneralError( | ||
error?.[0]?.reason | ||
? error[0].reason | ||
: 'An error occurred while adding the Linode to the group' | ||
} catch (errorResponse) { | ||
const error = getErrorStringOrDefault( | ||
errorResponse, | ||
'An error occurred while adding the Linode to the group' | ||
); | ||
enqueueSnackbar(error[0]?.reason, { variant: 'error' }); | ||
setGeneralError(error); | ||
enqueueSnackbar(error, { variant: 'error' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only test to complain from running the suite There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it safe to pass an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolutely not safe π€¦ fixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually it takes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, so yeah, since catch enqueueSnackbar([{ field: 'label', reason: 'Label is too long' }], {
variant,
}); |
||
} | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnussman-akamai i went with using an existing attribute as a CY selector instead, removing the need to pass a non type-safe one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! looks good