|
1 | 1 | import { type ApolloClient } from "@apollo/client"; |
| 2 | +import { createBooleanOptions } from "@dashboard/components/ConditionalFilter/constants"; |
2 | 3 | import { |
3 | 4 | _GetAttributeChoicesDocument, |
4 | 5 | type _GetAttributeChoicesQuery, |
@@ -40,6 +41,7 @@ import { |
40 | 41 | _GetWarehouseChoicesDocument, |
41 | 42 | type _GetWarehouseChoicesQuery, |
42 | 43 | type _GetWarehouseChoicesQueryVariables, |
| 44 | + AttributeInputTypeEnum, |
43 | 45 | ChannelCurrenciesDocument, |
44 | 46 | type ChannelCurrenciesQuery, |
45 | 47 | type ChannelCurrenciesQueryVariables, |
@@ -120,9 +122,18 @@ export class AttributeChoicesHandler implements Handler { |
120 | 122 | public client: ApolloClient<unknown>, |
121 | 123 | public attributeSlug: string, |
122 | 124 | public query: string, |
| 125 | + public type: string, |
123 | 126 | ) {} |
124 | 127 |
|
125 | 128 | fetch = async () => { |
| 129 | + /** |
| 130 | + * Entity-specific handlers don't work with Boolean type because it doesn't have options declared to fetch. |
| 131 | + * It's just true/false, so statically use it for Booleans, no matter the entity type. |
| 132 | + */ |
| 133 | + if (this.type === AttributeInputTypeEnum.BOOLEAN) { |
| 134 | + return createBooleanOptions(); |
| 135 | + } |
| 136 | + |
126 | 137 | const { client, attributeSlug, query } = this; |
127 | 138 | const { data } = await client.query< |
128 | 139 | _GetAttributeChoicesQuery, |
|
0 commit comments