mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #34310 from overleaf/mj-handle-lazy-errors-for-search-and-share
[web] Handle errors while loading full project search and share modal GitOrigin-RevId: 29d863324a54fa872022002f612498335f88f377
This commit is contained in:
committed by
Copybot
parent
b7735d402d
commit
fa36cd508b
+44
-2
@@ -19,6 +19,8 @@ import GiveFeedbackLink from '@/features/share-project-modal/components/give-fee
|
|||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
||||||
import { useShareProjectContext } from '@/features/share-project-modal/components/share-project-modal'
|
import { useShareProjectContext } from '@/features/share-project-modal/components/share-project-modal'
|
||||||
|
import { ErrorBoundaryFallback } from '@/shared/components/error-boundary-fallback'
|
||||||
|
import withErrorBoundary from '@/infrastructure/error-boundary'
|
||||||
|
|
||||||
const ReadOnlyTokenLink = lazy(() =>
|
const ReadOnlyTokenLink = lazy(() =>
|
||||||
import('./link-sharing').then(({ ReadOnlyTokenLink }) => ({
|
import('./link-sharing').then(({ ReadOnlyTokenLink }) => ({
|
||||||
@@ -46,6 +48,27 @@ export default function ShareProjectModalContent({
|
|||||||
error,
|
error,
|
||||||
projectName,
|
projectName,
|
||||||
}: ShareProjectModalContentProps) {
|
}: ShareProjectModalContentProps) {
|
||||||
|
return (
|
||||||
|
<OLModal show={show} onHide={cancel} animation={animation}>
|
||||||
|
<ShareProjectModalContentInnerWithErrorBoundary
|
||||||
|
inFlight={inFlight}
|
||||||
|
error={error}
|
||||||
|
projectName={projectName}
|
||||||
|
cancel={cancel}
|
||||||
|
/>
|
||||||
|
</OLModal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShareProjectModalContentInner({
|
||||||
|
inFlight,
|
||||||
|
error,
|
||||||
|
projectName,
|
||||||
|
cancel,
|
||||||
|
}: Pick<
|
||||||
|
ShareProjectModalContentProps,
|
||||||
|
'inFlight' | 'error' | 'projectName' | 'cancel'
|
||||||
|
>) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const isSharingUpdatesEnabled = useFeatureFlag('sharing-updates')
|
const isSharingUpdatesEnabled = useFeatureFlag('sharing-updates')
|
||||||
const [isInvitedPeopleScreen, setIsInvitedPeopleScreen] = useState(false)
|
const [isInvitedPeopleScreen, setIsInvitedPeopleScreen] = useState(false)
|
||||||
@@ -53,7 +76,7 @@ export default function ShareProjectModalContent({
|
|||||||
const { isRestrictedTokenMember, isProjectOwner } = useEditorContext()
|
const { isRestrictedTokenMember, isProjectOwner } = useEditorContext()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<OLModal show={show} onHide={cancel} animation={animation}>
|
<>
|
||||||
<OLModalHeader>
|
<OLModalHeader>
|
||||||
<div className="d-flex flex-grow-1 justify-content-between">
|
<div className="d-flex flex-grow-1 justify-content-between">
|
||||||
{isSharingUpdatesEnabled && isInvitedPeopleScreen ? (
|
{isSharingUpdatesEnabled && isInvitedPeopleScreen ? (
|
||||||
@@ -142,6 +165,25 @@ export default function ShareProjectModalContent({
|
|||||||
{t('close')}
|
{t('close')}
|
||||||
</ClickableElementEnhancer>
|
</ClickableElementEnhancer>
|
||||||
</OLModalFooter>
|
</OLModalFooter>
|
||||||
</OLModal>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ShareProjectModalContentInnerFallback = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<OLModalHeader>
|
||||||
|
<OLModalTitle>{t('generic_something_went_wrong')}</OLModalTitle>
|
||||||
|
</OLModalHeader>
|
||||||
|
<OLModalBody>
|
||||||
|
<ErrorBoundaryFallback />
|
||||||
|
</OLModalBody>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const ShareProjectModalContentInnerWithErrorBoundary = withErrorBoundary(
|
||||||
|
ShareProjectModalContentInner,
|
||||||
|
() => <ShareProjectModalContentInnerFallback />
|
||||||
|
)
|
||||||
|
|||||||
+5
-1
@@ -1,4 +1,6 @@
|
|||||||
import React, { FC, lazy, Suspense } from 'react'
|
import React, { FC, lazy, Suspense } from 'react'
|
||||||
|
import withErrorBoundary from '@/infrastructure/error-boundary'
|
||||||
|
import { ErrorBoundaryFallback } from '@/shared/components/error-boundary-fallback'
|
||||||
|
|
||||||
const FullProjectSearchUI = lazy(() => import('./full-project-search-ui'))
|
const FullProjectSearchUI = lazy(() => import('./full-project-search-ui'))
|
||||||
|
|
||||||
@@ -10,4 +12,6 @@ const FullProjectSearch: FC = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default FullProjectSearch
|
export default withErrorBoundary(FullProjectSearch, () => (
|
||||||
|
<ErrorBoundaryFallback />
|
||||||
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user