Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit f3f59fa

Browse files
committed
fix: draft notifications shown on admin
GraphQL aliases don't work properly with core sql optimisation so use two queries instead.
1 parent 289709f commit f3f59fa

5 files changed

Lines changed: 270 additions & 29 deletions

File tree

apps/admin-ui/gql/gql-types.ts

Lines changed: 85 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5323,11 +5323,11 @@ export enum Weekday {
53235323
Wednesday = "WEDNESDAY",
53245324
}
53255325

5326-
export type BannerNotificationsListQueryVariables = Exact<{
5327-
target: BannerNotificationTarget;
5326+
export type BannerNotificationsListAllQueryVariables = Exact<{
5327+
[key: string]: never;
53285328
}>;
53295329

5330-
export type BannerNotificationsListQuery = {
5330+
export type BannerNotificationsListAllQuery = {
53315331
bannerNotifications?: {
53325332
edges: Array<{
53335333
node?: {
@@ -5341,7 +5341,14 @@ export type BannerNotificationsListQuery = {
53415341
} | null;
53425342
} | null>;
53435343
} | null;
5344-
bannerNotificationsAll?: {
5344+
};
5345+
5346+
export type BannerNotificationsListQueryVariables = Exact<{
5347+
target: BannerNotificationTarget;
5348+
}>;
5349+
5350+
export type BannerNotificationsListQuery = {
5351+
bannerNotifications?: {
53455352
edges: Array<{
53465353
node?: {
53475354
id: string;
@@ -9464,16 +9471,86 @@ export const ApplicationRoundAdminFragmentDoc = gql`
94649471
}
94659472
${ApplicationRoundBaseFragmentDoc}
94669473
`;
9467-
export const BannerNotificationsListDocument = gql`
9468-
query BannerNotificationsList($target: BannerNotificationTarget!) {
9469-
bannerNotifications(isVisible: true, target: $target) {
9474+
export const BannerNotificationsListAllDocument = gql`
9475+
query BannerNotificationsListAll {
9476+
bannerNotifications(isVisible: true, target: ALL) {
94709477
edges {
94719478
node {
94729479
...BannerNotificationCommon
94739480
}
94749481
}
94759482
}
9476-
bannerNotificationsAll: bannerNotifications(isVisible: true, target: ALL) {
9483+
}
9484+
${BannerNotificationCommonFragmentDoc}
9485+
`;
9486+
9487+
/**
9488+
* __useBannerNotificationsListAllQuery__
9489+
*
9490+
* To run a query within a React component, call `useBannerNotificationsListAllQuery` and pass it any options that fit your needs.
9491+
* When your component renders, `useBannerNotificationsListAllQuery` returns an object from Apollo Client that contains loading, error, and data properties
9492+
* you can use to render your UI.
9493+
*
9494+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
9495+
*
9496+
* @example
9497+
* const { data, loading, error } = useBannerNotificationsListAllQuery({
9498+
* variables: {
9499+
* },
9500+
* });
9501+
*/
9502+
export function useBannerNotificationsListAllQuery(
9503+
baseOptions?: Apollo.QueryHookOptions<
9504+
BannerNotificationsListAllQuery,
9505+
BannerNotificationsListAllQueryVariables
9506+
>
9507+
) {
9508+
const options = { ...defaultOptions, ...baseOptions };
9509+
return Apollo.useQuery<
9510+
BannerNotificationsListAllQuery,
9511+
BannerNotificationsListAllQueryVariables
9512+
>(BannerNotificationsListAllDocument, options);
9513+
}
9514+
export function useBannerNotificationsListAllLazyQuery(
9515+
baseOptions?: Apollo.LazyQueryHookOptions<
9516+
BannerNotificationsListAllQuery,
9517+
BannerNotificationsListAllQueryVariables
9518+
>
9519+
) {
9520+
const options = { ...defaultOptions, ...baseOptions };
9521+
return Apollo.useLazyQuery<
9522+
BannerNotificationsListAllQuery,
9523+
BannerNotificationsListAllQueryVariables
9524+
>(BannerNotificationsListAllDocument, options);
9525+
}
9526+
export function useBannerNotificationsListAllSuspenseQuery(
9527+
baseOptions?: Apollo.SuspenseQueryHookOptions<
9528+
BannerNotificationsListAllQuery,
9529+
BannerNotificationsListAllQueryVariables
9530+
>
9531+
) {
9532+
const options = { ...defaultOptions, ...baseOptions };
9533+
return Apollo.useSuspenseQuery<
9534+
BannerNotificationsListAllQuery,
9535+
BannerNotificationsListAllQueryVariables
9536+
>(BannerNotificationsListAllDocument, options);
9537+
}
9538+
export type BannerNotificationsListAllQueryHookResult = ReturnType<
9539+
typeof useBannerNotificationsListAllQuery
9540+
>;
9541+
export type BannerNotificationsListAllLazyQueryHookResult = ReturnType<
9542+
typeof useBannerNotificationsListAllLazyQuery
9543+
>;
9544+
export type BannerNotificationsListAllSuspenseQueryHookResult = ReturnType<
9545+
typeof useBannerNotificationsListAllSuspenseQuery
9546+
>;
9547+
export type BannerNotificationsListAllQueryResult = Apollo.QueryResult<
9548+
BannerNotificationsListAllQuery,
9549+
BannerNotificationsListAllQueryVariables
9550+
>;
9551+
export const BannerNotificationsListDocument = gql`
9552+
query BannerNotificationsList($target: BannerNotificationTarget!) {
9553+
bannerNotifications(isVisible: true, target: $target) {
94779554
edges {
94789555
node {
94799556
...BannerNotificationCommon

apps/ui/gql/gql-types.ts

Lines changed: 85 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6939,11 +6939,11 @@ export type PriceReservationUnitFragment = {
69396939
}>;
69406940
};
69416941

6942-
export type BannerNotificationsListQueryVariables = Exact<{
6943-
target: BannerNotificationTarget;
6942+
export type BannerNotificationsListAllQueryVariables = Exact<{
6943+
[key: string]: never;
69446944
}>;
69456945

6946-
export type BannerNotificationsListQuery = {
6946+
export type BannerNotificationsListAllQuery = {
69476947
bannerNotifications?: {
69486948
edges: Array<{
69496949
node?: {
@@ -6957,7 +6957,14 @@ export type BannerNotificationsListQuery = {
69576957
} | null;
69586958
} | null>;
69596959
} | null;
6960-
bannerNotificationsAll?: {
6960+
};
6961+
6962+
export type BannerNotificationsListQueryVariables = Exact<{
6963+
target: BannerNotificationTarget;
6964+
}>;
6965+
6966+
export type BannerNotificationsListQuery = {
6967+
bannerNotifications?: {
69616968
edges: Array<{
69626969
node?: {
69636970
id: string;
@@ -10289,16 +10296,86 @@ export type CurrentUserQueryResult = Apollo.QueryResult<
1028910296
CurrentUserQuery,
1029010297
CurrentUserQueryVariables
1029110298
>;
10292-
export const BannerNotificationsListDocument = gql`
10293-
query BannerNotificationsList($target: BannerNotificationTarget!) {
10294-
bannerNotifications(isVisible: true, target: $target) {
10299+
export const BannerNotificationsListAllDocument = gql`
10300+
query BannerNotificationsListAll {
10301+
bannerNotifications(isVisible: true, target: ALL) {
1029510302
edges {
1029610303
node {
1029710304
...BannerNotificationCommon
1029810305
}
1029910306
}
1030010307
}
10301-
bannerNotificationsAll: bannerNotifications(isVisible: true, target: ALL) {
10308+
}
10309+
${BannerNotificationCommonFragmentDoc}
10310+
`;
10311+
10312+
/**
10313+
* __useBannerNotificationsListAllQuery__
10314+
*
10315+
* To run a query within a React component, call `useBannerNotificationsListAllQuery` and pass it any options that fit your needs.
10316+
* When your component renders, `useBannerNotificationsListAllQuery` returns an object from Apollo Client that contains loading, error, and data properties
10317+
* you can use to render your UI.
10318+
*
10319+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
10320+
*
10321+
* @example
10322+
* const { data, loading, error } = useBannerNotificationsListAllQuery({
10323+
* variables: {
10324+
* },
10325+
* });
10326+
*/
10327+
export function useBannerNotificationsListAllQuery(
10328+
baseOptions?: Apollo.QueryHookOptions<
10329+
BannerNotificationsListAllQuery,
10330+
BannerNotificationsListAllQueryVariables
10331+
>
10332+
) {
10333+
const options = { ...defaultOptions, ...baseOptions };
10334+
return Apollo.useQuery<
10335+
BannerNotificationsListAllQuery,
10336+
BannerNotificationsListAllQueryVariables
10337+
>(BannerNotificationsListAllDocument, options);
10338+
}
10339+
export function useBannerNotificationsListAllLazyQuery(
10340+
baseOptions?: Apollo.LazyQueryHookOptions<
10341+
BannerNotificationsListAllQuery,
10342+
BannerNotificationsListAllQueryVariables
10343+
>
10344+
) {
10345+
const options = { ...defaultOptions, ...baseOptions };
10346+
return Apollo.useLazyQuery<
10347+
BannerNotificationsListAllQuery,
10348+
BannerNotificationsListAllQueryVariables
10349+
>(BannerNotificationsListAllDocument, options);
10350+
}
10351+
export function useBannerNotificationsListAllSuspenseQuery(
10352+
baseOptions?: Apollo.SuspenseQueryHookOptions<
10353+
BannerNotificationsListAllQuery,
10354+
BannerNotificationsListAllQueryVariables
10355+
>
10356+
) {
10357+
const options = { ...defaultOptions, ...baseOptions };
10358+
return Apollo.useSuspenseQuery<
10359+
BannerNotificationsListAllQuery,
10360+
BannerNotificationsListAllQueryVariables
10361+
>(BannerNotificationsListAllDocument, options);
10362+
}
10363+
export type BannerNotificationsListAllQueryHookResult = ReturnType<
10364+
typeof useBannerNotificationsListAllQuery
10365+
>;
10366+
export type BannerNotificationsListAllLazyQueryHookResult = ReturnType<
10367+
typeof useBannerNotificationsListAllLazyQuery
10368+
>;
10369+
export type BannerNotificationsListAllSuspenseQueryHookResult = ReturnType<
10370+
typeof useBannerNotificationsListAllSuspenseQuery
10371+
>;
10372+
export type BannerNotificationsListAllQueryResult = Apollo.QueryResult<
10373+
BannerNotificationsListAllQuery,
10374+
BannerNotificationsListAllQueryVariables
10375+
>;
10376+
export const BannerNotificationsListDocument = gql`
10377+
query BannerNotificationsList($target: BannerNotificationTarget!) {
10378+
bannerNotifications(isVisible: true, target: $target) {
1030210379
edges {
1030310380
node {
1030410381
...BannerNotificationCommon

packages/common/gql/gql-types.ts

Lines changed: 85 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5323,11 +5323,11 @@ export enum Weekday {
53235323
Wednesday = "WEDNESDAY",
53245324
}
53255325

5326-
export type BannerNotificationsListQueryVariables = Exact<{
5327-
target: BannerNotificationTarget;
5326+
export type BannerNotificationsListAllQueryVariables = Exact<{
5327+
[key: string]: never;
53285328
}>;
53295329

5330-
export type BannerNotificationsListQuery = {
5330+
export type BannerNotificationsListAllQuery = {
53315331
bannerNotifications?: {
53325332
edges: Array<{
53335333
node?: {
@@ -5341,7 +5341,14 @@ export type BannerNotificationsListQuery = {
53415341
} | null;
53425342
} | null>;
53435343
} | null;
5344-
bannerNotificationsAll?: {
5344+
};
5345+
5346+
export type BannerNotificationsListQueryVariables = Exact<{
5347+
target: BannerNotificationTarget;
5348+
}>;
5349+
5350+
export type BannerNotificationsListQuery = {
5351+
bannerNotifications?: {
53455352
edges: Array<{
53465353
node?: {
53475354
id: string;
@@ -6339,16 +6346,86 @@ export const MetadataSetsFragmentDoc = gql`
63396346
}
63406347
}
63416348
`;
6342-
export const BannerNotificationsListDocument = gql`
6343-
query BannerNotificationsList($target: BannerNotificationTarget!) {
6344-
bannerNotifications(isVisible: true, target: $target) {
6349+
export const BannerNotificationsListAllDocument = gql`
6350+
query BannerNotificationsListAll {
6351+
bannerNotifications(isVisible: true, target: ALL) {
63456352
edges {
63466353
node {
63476354
...BannerNotificationCommon
63486355
}
63496356
}
63506357
}
6351-
bannerNotificationsAll: bannerNotifications(isVisible: true, target: ALL) {
6358+
}
6359+
${BannerNotificationCommonFragmentDoc}
6360+
`;
6361+
6362+
/**
6363+
* __useBannerNotificationsListAllQuery__
6364+
*
6365+
* To run a query within a React component, call `useBannerNotificationsListAllQuery` and pass it any options that fit your needs.
6366+
* When your component renders, `useBannerNotificationsListAllQuery` returns an object from Apollo Client that contains loading, error, and data properties
6367+
* you can use to render your UI.
6368+
*
6369+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
6370+
*
6371+
* @example
6372+
* const { data, loading, error } = useBannerNotificationsListAllQuery({
6373+
* variables: {
6374+
* },
6375+
* });
6376+
*/
6377+
export function useBannerNotificationsListAllQuery(
6378+
baseOptions?: Apollo.QueryHookOptions<
6379+
BannerNotificationsListAllQuery,
6380+
BannerNotificationsListAllQueryVariables
6381+
>
6382+
) {
6383+
const options = { ...defaultOptions, ...baseOptions };
6384+
return Apollo.useQuery<
6385+
BannerNotificationsListAllQuery,
6386+
BannerNotificationsListAllQueryVariables
6387+
>(BannerNotificationsListAllDocument, options);
6388+
}
6389+
export function useBannerNotificationsListAllLazyQuery(
6390+
baseOptions?: Apollo.LazyQueryHookOptions<
6391+
BannerNotificationsListAllQuery,
6392+
BannerNotificationsListAllQueryVariables
6393+
>
6394+
) {
6395+
const options = { ...defaultOptions, ...baseOptions };
6396+
return Apollo.useLazyQuery<
6397+
BannerNotificationsListAllQuery,
6398+
BannerNotificationsListAllQueryVariables
6399+
>(BannerNotificationsListAllDocument, options);
6400+
}
6401+
export function useBannerNotificationsListAllSuspenseQuery(
6402+
baseOptions?: Apollo.SuspenseQueryHookOptions<
6403+
BannerNotificationsListAllQuery,
6404+
BannerNotificationsListAllQueryVariables
6405+
>
6406+
) {
6407+
const options = { ...defaultOptions, ...baseOptions };
6408+
return Apollo.useSuspenseQuery<
6409+
BannerNotificationsListAllQuery,
6410+
BannerNotificationsListAllQueryVariables
6411+
>(BannerNotificationsListAllDocument, options);
6412+
}
6413+
export type BannerNotificationsListAllQueryHookResult = ReturnType<
6414+
typeof useBannerNotificationsListAllQuery
6415+
>;
6416+
export type BannerNotificationsListAllLazyQueryHookResult = ReturnType<
6417+
typeof useBannerNotificationsListAllLazyQuery
6418+
>;
6419+
export type BannerNotificationsListAllSuspenseQueryHookResult = ReturnType<
6420+
typeof useBannerNotificationsListAllSuspenseQuery
6421+
>;
6422+
export type BannerNotificationsListAllQueryResult = Apollo.QueryResult<
6423+
BannerNotificationsListAllQuery,
6424+
BannerNotificationsListAllQueryVariables
6425+
>;
6426+
export const BannerNotificationsListDocument = gql`
6427+
query BannerNotificationsList($target: BannerNotificationTarget!) {
6428+
bannerNotifications(isVisible: true, target: $target) {
63526429
edges {
63536430
node {
63546431
...BannerNotificationCommon

packages/common/src/components/BannerNotificationsList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getTranslation } from "../common/util";
88
import { breakpoints } from "../common/style";
99
import {
1010
BannerNotificationTarget,
11+
useBannerNotificationsListAllQuery,
1112
useBannerNotificationsListQuery,
1213
type BannerNotificationCommonFragment,
1314
} from "../../gql/gql-types";
@@ -123,8 +124,11 @@ const BannerNotificationsList = ({
123124
},
124125
fetchPolicy: "no-cache",
125126
});
127+
const { data: dataAll } = useBannerNotificationsListAllQuery({
128+
fetchPolicy: "no-cache",
129+
});
126130
const notificationsTarget = data?.bannerNotifications;
127-
const notificationsAll = data?.bannerNotificationsAll;
131+
const notificationsAll = dataAll?.bannerNotifications;
128132
const comb = [
129133
...(notificationsAll?.edges ?? []),
130134
...(notificationsTarget?.edges ?? []),

0 commit comments

Comments
 (0)