diff --git a/apps/callcenter b/apps/callcenter index b4eac8bacb0..2559182ff3b 160000 --- a/apps/callcenter +++ b/apps/callcenter @@ -1 +1 @@ -Subproject commit b4eac8bacb04dbcfe81cad852337d288e94e1f17 +Subproject commit 2559182ff3b0a7ff2136c4804212e30ee075bb75 diff --git a/apps/condo/pages/contact/[id]/index.tsx b/apps/condo/pages/contact/[id]/index.tsx index d5333354b35..c6b814622c9 100644 --- a/apps/condo/pages/contact/[id]/index.tsx +++ b/apps/condo/pages/contact/[id]/index.tsx @@ -8,7 +8,7 @@ import get from 'lodash/get' import Head from 'next/head' import Link from 'next/link' import { useRouter } from 'next/router' -import React, { CSSProperties, useCallback } from 'react' +import React, { CSSProperties, useCallback, useMemo } from 'react' import { useCachePersistor } from '@open-condo/apollo' import { getClientSideSenderInfo } from '@open-condo/codegen/utils/userId' @@ -211,14 +211,15 @@ export const ContactPageContent = ({ contact, isContactEditable, softDeleteActio ) } -const ContactInfoPage: PageComponentType<{ id: string }> = ({ id: contactId }) => { +const ContactInfoPage: PageComponentType = () => { const intl = useIntl() const ErrorMessage = intl.formatMessage({ id: 'errors.LoadingError' }) const LoadingMessage = intl.formatMessage({ id: 'Loading' }) const ContactNotFoundTitle = intl.formatMessage({ id: 'Contact.NotFound.Title' }) const ContactNotFoundMessage = intl.formatMessage({ id: 'Contact.NotFound.Message' }) - const { push } = useRouter() + const { push, query } = useRouter() + const { id: contactId } = query as { id: string } const { role } = useOrganization() const { persistor } = useCachePersistor() @@ -232,6 +233,7 @@ const ContactInfoPage: PageComponentType<{ id: string }> = ({ id: contactId }) = }) const filteredContacts = data?.contacts?.filter(Boolean) const contact = Array.isArray(filteredContacts) && filteredContacts.length > 0 ? filteredContacts[0] : null + const contactLoading = useMemo(() => loading || !persistor, [loading, persistor]) const [updateContactMutation] = useUpdateContactMutation({ variables: { @@ -249,8 +251,8 @@ const ContactInfoPage: PageComponentType<{ id: string }> = ({ id: contactId }) = await push('/contact') }, [push, updateContactMutation]) - if (error || loading) { - return + if (error || contactLoading) { + return } if (!contact) { return @@ -276,9 +278,7 @@ ContactInfoPage.getPrefetchedData = async ({ context, apolloClient }) => { await prefetchContact({ client: apolloClient, contactId }) return { - props: { - id: contactId, - }, + props: {}, } } diff --git a/apps/condo/pages/ticket/[id]/index.tsx b/apps/condo/pages/ticket/[id]/index.tsx index 45e9e4c83a2..898f34889cc 100644 --- a/apps/condo/pages/ticket/[id]/index.tsx +++ b/apps/condo/pages/ticket/[id]/index.tsx @@ -21,6 +21,7 @@ import isEmpty from 'lodash/isEmpty' import map from 'lodash/map' import Head from 'next/head' import Link from 'next/link' +import { useRouter } from 'next/router' import { CSSProperties, useCallback, useEffect, useMemo, useState } from 'react' import { useCachePersistor } from '@open-condo/apollo' @@ -797,12 +798,14 @@ export const TicketPageContent = ({ ticket, pollCommentsQuery, refetchTicket, or ) } -const TicketIdPage: PageComponentType<{ id: string }> = ({ id }) => { +const TicketIdPage: PageComponentType = () => { const intl = useIntl() const ServerErrorMessage = intl.formatMessage({ id: 'ServerError' }) const { user } = useAuth() const { link, organization, selectEmployee } = useOrganization() + const { query } = useRouter() + const { id } = query as { id: string } const { persistor } = useCachePersistor() @@ -898,9 +901,7 @@ TicketIdPage.getPrefetchedData = async ({ context, apolloClient }) => { await prefetchTicket({ client: apolloClient, ticketId }) return { - props: { - id: ticketId, - }, + props: {}, } } diff --git a/apps/condo/pages/ticket/[id]/update.tsx b/apps/condo/pages/ticket/[id]/update.tsx index b0c10bb004f..d995fd78fcc 100644 --- a/apps/condo/pages/ticket/[id]/update.tsx +++ b/apps/condo/pages/ticket/[id]/update.tsx @@ -1,5 +1,6 @@ import { Typography, Row, Col } from 'antd' import Head from 'next/head' +import { useRouter } from 'next/router' import React from 'react' import { useIntl } from '@open-condo/next/intl' @@ -11,10 +12,14 @@ import { TicketForm } from '@condo/domains/ticket/components/TicketForm' import { prefetchTicket } from '@condo/domains/ticket/utils/next/Ticket' -const TicketUpdatePage: PageComponentType<{ id: string }> = ({ id }) => { +const TicketUpdatePage: PageComponentType = () => { const intl = useIntl() const PageTitleMsg = intl.formatMessage({ id:'pages.condo.ticket.index.EditTicketModalTitle' }) + const router = useRouter() + const { query } = router + const { id } = query as { id: string } + return ( <> @@ -43,9 +48,7 @@ TicketUpdatePage.getPrefetchedData = async ({ context, apolloClient }) => { await prefetchTicket({ client: apolloClient, ticketId }) return { - props: { - id: ticketId, - }, + props: {}, } }