Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Display object not found if query returned null

dominik-zeglen835670df68fe
diff --git a/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx b/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx
index 193dbc1d3a..153c3f81db 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx
@@ -97,6 +97,7 @@ export const CategoryDetails: React.StatelessComponent<
<TypedCategoryDetailsQuery
displayLoader
variables={{ ...paginationState, id }}
+ require={["category"]}
>
{({ data, loading }) => (
<>
diff --git a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
index 85309fef06..0af791922a 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
@@ -58,6 +58,7 @@ export const CollectionDetails: React.StatelessComponent<
<TypedCollectionDetailsQuery
displayLoader
variables={{ id, ...paginationState }}
+ require={["collection"]}
>
{({ data, loading }) => {
const handleCollectionUpdate = (data: CollectionUpdate) => {
diff --git a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
index 13f8aab47b..552cf5267b 100644
--- a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
+++ b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
@@ -70,7 +70,11 @@ export const CustomerDetailsView: React.StatelessComponent<
onCompleted={handleCustomerUpdateSuccess}
>
{(updateCustomer, updateCustomerOpts) => (
- <TypedCustomerDetailsQuery displayLoader variables={{ id }}>
+ <TypedCustomerDetailsQuery
+ displayLoader
+ variables={{ id }}
+ require={["user"]}
+ >
{customerDetails => {
const formTransitionState = getMutationState(
updateCustomerOpts.called,
diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx
index b4daad9d49..8ace4ad39f 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx
@@ -98,7 +98,11 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
}) => (
<Navigator>
{navigate => (
- <TypedOrderDetailsQuery displayLoader variables={{ id }}>
+ <TypedOrderDetailsQuery
+ displayLoader
+ variables={{ id }}
+ require={["order"]}
+ >
{({ data, error, loading }) => {
if (error) {
return <ErrorMessageCard message="Something went wrong" />;
diff --git a/saleor/static/dashboard-next/pages/views/PageDetails.tsx b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
index d3c8415dbe..9663066f36 100644
--- a/saleor/static/dashboard-next/pages/views/PageDetails.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
@@ -30,7 +30,11 @@ export class PageUpdateForm extends React.Component<
render() {
const { id } = this.props;
return (
- <TypedPageDetailsQuery displayLoader variables={{ id }}>
+ <TypedPageDetailsQuery
+ displayLoader
+ variables={{ id }}
+ require={["page"]}
+ >
{({ data, loading }) => (
<TypedPageDeleteMutation>
{(
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
index 646a7d3586..2c2c7361f7 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
@@ -46,7 +46,11 @@ export const ProductTypeUpdate: React.StatelessComponent<
{navigate => (
<ProductTypeUpdateErrors>
{({ errors, set: setErrors }) => (
- <TypedProductTypeDetailsQuery displayLoader variables={{ id }}>
+ <TypedProductTypeDetailsQuery
+ displayLoader
+ variables={{ id }}
+ require={["productType"]}
+ >
{({ data, loading: dataLoading }) => {
const closeModal = () => {
navigate(productTypeUrl(id), true);
diff --git a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
index 27f14b4a2c..b000f3e04c 100644
--- a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
@@ -46,6 +46,7 @@ export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
imageId,
productId
}}
+ require={["product"]}
>
{({ data, loading }) => {
return (
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx
index 0cc199b844..02cd84884c 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx
@@ -52,6 +52,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
}) => (
<TypedProductDetailsQuery
displayLoader
+ require={["product"]}
variables={{ id }}
>
{({ data, loading }) => {
diff --git a/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx b/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx
index 6393074f37..49128647ce 100644
--- a/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx
@@ -41,7 +41,11 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({
{navigate => (
<Messages>
{pushMessage => (
- <TypedProductVariantQuery displayLoader variables={{ id: variantId }}>
+ <TypedProductVariantQuery
+ displayLoader
+ variables={{ id: variantId }}
+ require={["productVariant"]}
+ >
{({ data, loading, error }) => {
if (error) {
return <ErrorMessageCard message="Something went wrong" />;
diff --git a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx
index 3916c11976..3f47e8ba83 100644
--- a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx
@@ -40,6 +40,7 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({
<TypedProductVariantCreateQuery
displayLoader
variables={{ id: productId }}
+ require={["product"]}
>
{({ data, loading: productLoading }) => {
const handleCreateSuccess = (data: VariantCreate) => {
diff --git a/saleor/static/dashboard-next/staff/views/StaffDetails.tsx b/saleor/static/dashboard-next/staff/views/StaffDetails.tsx
index 402a5dac88..03299148ff 100644
--- a/saleor/static/dashboard-next/staff/views/StaffDetails.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffDetails.tsx
@@ -34,7 +34,11 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({
{navigate => (
<Messages>
{pushMessage => (
- <TypedStaffMemberDetailsQuery displayLoader variables={{ id }}>
+ <TypedStaffMemberDetailsQuery
+ displayLoader
+ variables={{ id }}
+ require={["user"]}
+ >
{({ data, loading }) => {
const handleStaffMemberUpdate = (data: StaffMemberUpdate) => {
if (!maybe(() => data.staffUpdate.errors.length !== 0)) {