Skip to content
5 changes: 5 additions & 0 deletions .changeset/large-showers-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Remove Content Attributes from `All Products` column picker.
10 changes: 6 additions & 4 deletions src/graphql/hooks.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16172,8 +16172,8 @@ export type ProductMediaByIdQueryHookResult = ReturnType<typeof useProductMediaB
export type ProductMediaByIdLazyQueryHookResult = ReturnType<typeof useProductMediaByIdLazyQuery>;
export type ProductMediaByIdQueryResult = Apollo.QueryResult<Types.ProductMediaByIdQuery, Types.ProductMediaByIdQueryVariables>;
export const GridAttributesDocument = gql`
query GridAttributes($ids: [ID!]!, $hasAttributes: Boolean!) {
availableAttributes: attributes(first: 10) {
query GridAttributes($ids: [ID!]!, $hasAttributes: Boolean!, $type: AttributeTypeEnum!) {
availableAttributes: attributes(first: 10, filter: {type: $type}) {
edges {
node {
id
Expand Down Expand Up @@ -16209,6 +16209,7 @@ export const GridAttributesDocument = gql`
* variables: {
* ids: // value for 'ids'
* hasAttributes: // value for 'hasAttributes'
* type: // value for 'type'
* },
* });
*/
Expand All @@ -16224,9 +16225,9 @@ export type GridAttributesQueryHookResult = ReturnType<typeof useGridAttributesQ
export type GridAttributesLazyQueryHookResult = ReturnType<typeof useGridAttributesLazyQuery>;
export type GridAttributesQueryResult = Apollo.QueryResult<Types.GridAttributesQuery, Types.GridAttributesQueryVariables>;
export const AvailableColumnAttributesDocument = gql`
query AvailableColumnAttributes($search: String!, $before: String, $after: String, $first: Int, $last: Int) {
query AvailableColumnAttributes($search: String!, $type: AttributeTypeEnum!, $before: String, $after: String, $first: Int, $last: Int) {
attributes(
filter: {search: $search}
filter: {search: $search, type: $type}
before: $before
after: $after
first: $first
Expand Down Expand Up @@ -16258,6 +16259,7 @@ export const AvailableColumnAttributesDocument = gql`
* const { data, loading, error } = useAvailableColumnAttributesQuery({
* variables: {
* search: // value for 'search'
* type: // value for 'type'
* before: // value for 'before'
* after: // value for 'after'
* first: // value for 'first'
Expand Down
2 changes: 2 additions & 0 deletions src/graphql/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11765,13 +11765,15 @@ export type ProductMediaByIdQuery = { __typename: 'Query', product: { __typename
export type GridAttributesQueryVariables = Exact<{
ids: Array<Scalars['ID']> | Scalars['ID'];
hasAttributes: Scalars['Boolean'];
type: AttributeTypeEnum;
}>;


export type GridAttributesQuery = { __typename: 'Query', availableAttributes: { __typename: 'AttributeCountableConnection', edges: Array<{ __typename: 'AttributeCountableEdge', node: { __typename: 'Attribute', id: string, name: string | null } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null, selectedAttributes: { __typename: 'AttributeCountableConnection', edges: Array<{ __typename: 'AttributeCountableEdge', node: { __typename: 'Attribute', id: string, name: string | null } }> } | null };

export type AvailableColumnAttributesQueryVariables = Exact<{
search: Scalars['String'];
type: AttributeTypeEnum;
before?: InputMaybe<Scalars['String']>;
after?: InputMaybe<Scalars['String']>;
first?: InputMaybe<Scalars['Int']>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { TablePaginationWithContext } from "@dashboard/components/TablePaginatio
import { commonTooltipMessages } from "@dashboard/components/TooltipTableCellHeader/messages";
import { ProductListColumns } from "@dashboard/config";
import {
AttributeTypeEnum,
Exact,
GridAttributesQuery,
ProductListQuery,
Expand Down Expand Up @@ -129,7 +130,7 @@ export const ProductListDatagrid = ({
sort,
onSearch: (query: string) =>
queryAvailableColumnsAttributes({
variables: { search: query, first: 10 },
variables: { search: query, first: 10, type: AttributeTypeEnum.PRODUCT_TYPE },
}),
initialSearch: availableColumnsAttributesData.variables?.search ?? "",
...getAttributesFetchMoreProps({
Expand Down
4 changes: 4 additions & 0 deletions src/products/components/ProductListDatagrid/datagrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { GetCellContentOpts } from "@dashboard/components/Datagrid/Datagrid";
import { AvailableColumn } from "@dashboard/components/Datagrid/types";
import { Locale } from "@dashboard/components/Locale";
import {
AttributeTypeEnum,
AvailableColumnAttributesQuery,
Exact,
GridAttributesQuery,
Expand Down Expand Up @@ -496,6 +497,7 @@ type AttributesLazyQuery = (
options?: QueryLazyOptions<
Exact<{
search: string;
type: AttributeTypeEnum;
before?: string;
after?: string;
first?: number;
Expand Down Expand Up @@ -534,6 +536,7 @@ export const getAttributesFetchMoreProps = ({
queryAvailableColumnsAttributes({
variables: {
search: query,
type: AttributeTypeEnum.PRODUCT_TYPE,
after:
availableColumnsAttributesData.data?.attributes?.pageInfo.endCursor ??
gridAttributesOpts.data?.availableAttributes?.pageInfo.endCursor,
Expand All @@ -546,6 +549,7 @@ export const getAttributesFetchMoreProps = ({
queryAvailableColumnsAttributes({
variables: {
search: query,
type: AttributeTypeEnum.PRODUCT_TYPE,
before: availableColumnsAttributesData.data?.attributes?.pageInfo.startCursor,
last: 10,
first: null,
Expand Down
7 changes: 4 additions & 3 deletions src/products/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ export const productMediaQuery = gql`
`;

export const gridAttributes = gql`
query GridAttributes($ids: [ID!]!, $hasAttributes: Boolean!) {
availableAttributes: attributes(first: 10) {
query GridAttributes($ids: [ID!]!, $hasAttributes: Boolean!, $type: AttributeTypeEnum!) {
availableAttributes: attributes(first: 10, filter: { type: $type }) {
edges {
node {
id
Expand All @@ -213,13 +213,14 @@ export const gridAttributes = gql`
export const availableColumnAttribues = gql`
query AvailableColumnAttributes(
$search: String!
$type: AttributeTypeEnum!
$before: String
$after: String
$first: Int
$last: Int
) {
attributes(
filter: { search: $search }
filter: { search: $search, type: $type }
before: $before
after: $after
first: $first
Expand Down
2 changes: 2 additions & 0 deletions src/products/views/ProductList/ProductList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "@dashboard/config";
import { Task } from "@dashboard/containers/BackgroundTasks/types";
import {
AttributeTypeEnum,
ProductListQueryVariables,
useAvailableColumnAttributesLazyQuery,
useGridAttributesLazyQuery,
Expand Down Expand Up @@ -259,6 +260,7 @@ const ProductList = ({ params }: ProductListProps) => {
variables: {
ids: filteredColumnIds,
hasAttributes: !!filteredColumnIds.length,
type: AttributeTypeEnum.PRODUCT_TYPE,
},
});
}, []);
Expand Down
Loading