From 8a7c4ac8f7e44e1e71b19a41c4f7ced7e58c4ef8 Mon Sep 17 00:00:00 2001 From: Pavel Date: Mon, 25 Nov 2024 13:04:22 +0500 Subject: [PATCH 1/2] fix(condo): DOMA-10739 wait for persistor on contact id page --- apps/callcenter | 2 +- apps/condo/pages/contact/[id]/index.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/callcenter b/apps/callcenter index b4eac8bacb0..3abea92e844 160000 --- a/apps/callcenter +++ b/apps/callcenter @@ -1 +1 @@ -Subproject commit b4eac8bacb04dbcfe81cad852337d288e94e1f17 +Subproject commit 3abea92e84430379908138b7f4e0ca3d4ddb0184 diff --git a/apps/condo/pages/contact/[id]/index.tsx b/apps/condo/pages/contact/[id]/index.tsx index d5333354b35..a6eabb50aa6 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' @@ -232,6 +232,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 +250,8 @@ const ContactInfoPage: PageComponentType<{ id: string }> = ({ id: contactId }) = await push('/contact') }, [push, updateContactMutation]) - if (error || loading) { - return + if (error || contactLoading) { + return } if (!contact) { return From eceeb01abd94eecdf116241d889f28682ef4c8e2 Mon Sep 17 00:00:00 2001 From: Pavel Date: Tue, 26 Nov 2024 12:07:14 +0500 Subject: [PATCH 2/2] chore(callcenter): DOMA-10739 move submodule to main --- apps/callcenter | 2 +- apps/condo/pages/contact/[id]/index.tsx | 9 ++++----- apps/condo/pages/ticket/[id]/index.tsx | 9 +++++---- apps/condo/pages/ticket/[id]/update.tsx | 11 +++++++---- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/apps/callcenter b/apps/callcenter index 3abea92e844..2559182ff3b 160000 --- a/apps/callcenter +++ b/apps/callcenter @@ -1 +1 @@ -Subproject commit 3abea92e84430379908138b7f4e0ca3d4ddb0184 +Subproject commit 2559182ff3b0a7ff2136c4804212e30ee075bb75 diff --git a/apps/condo/pages/contact/[id]/index.tsx b/apps/condo/pages/contact/[id]/index.tsx index a6eabb50aa6..c6b814622c9 100644 --- a/apps/condo/pages/contact/[id]/index.tsx +++ b/apps/condo/pages/contact/[id]/index.tsx @@ -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() @@ -277,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: {}, } }