Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove unnecesary null checks
dominik-zeglenb63e9c5909c2
diff --git a/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx b/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsxindex 153c3f81db..4ae8912863 100644--- a/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx+++ b/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx@@ -53,10 +53,7 @@ export const CategoryDetails: React.StatelessComponent<<Messages>{pushMessage => {const onCategoryDelete = (data: CategoryDelete) => {- if (- data.categoryDelete.errors === null ||- data.categoryDelete.errors.length === 0- ) {+ if (data.categoryDelete.errors.length === 0) {pushMessage({text: i18n.t("Category deleted", {context: "notification"diff --git a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsxindex de7376c659..be9636e58a 100644--- a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx+++ b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx@@ -16,10 +16,7 @@ export const CollectionCreate: React.StatelessComponent<{}> = () => (<Navigator>{navigate => {const handleCollectionCreateSuccess = (data: CreateCollection) => {- if (- data.collectionCreate.errors === null ||- data.collectionCreate.errors.length === 0- ) {+ if (data.collectionCreate.errors.length === 0) {pushMessage({text: i18n.t("Created collection", {context: "notification"diff --git a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsxindex 5940e5c4bd..1be060e924 100644--- a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx+++ b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx@@ -61,10 +61,7 @@ export const CollectionDetails: React.StatelessComponent<>{({ data, loading }) => {const handleCollectionUpdate = (data: CollectionUpdate) => {- if (- data.collectionUpdate.errors === null ||- data.collectionUpdate.errors.length === 0- ) {+ if (data.collectionUpdate.errors.length === 0) {pushMessage({text: i18n.t("Updated collection", {context: "notification"@@ -75,10 +72,7 @@ export const CollectionDetails: React.StatelessComponent<};const handleProductAssign = (data: CollectionAssignProduct) => {- if (- data.collectionAddProducts.errors === null ||- data.collectionAddProducts.errors.length === 0- ) {+ if (data.collectionAddProducts.errors.length === 0) {pushMessage({text: i18n.t("Added product to collection", {context: "notification"@@ -91,10 +85,7 @@ export const CollectionDetails: React.StatelessComponent<const handleProductUnassign = (data: UnassignCollectionProduct) => {- if (- data.collectionRemoveProducts.errors === null ||- data.collectionRemoveProducts.errors.length === 0- ) {+ if (data.collectionRemoveProducts.errors.length === 0) {pushMessage({text: i18n.t("Removed product from collection", {context: "notification"@@ -104,10 +95,7 @@ export const CollectionDetails: React.StatelessComponent<};const handleCollectionRemove = (data: RemoveCollection) => {- if (- data.collectionDelete.errors === null ||- data.collectionDelete.errors.length === 0- ) {+ if (data.collectionDelete.errors.length === 0) {pushMessage({text: i18n.t("Removed collection", {context: "notification"diff --git a/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx b/saleor/static/dashboard-next/customers/views/CustomerCreate.tsxindex 40885b7c9c..90250df9a2 100644--- a/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx+++ b/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx@@ -17,10 +17,7 @@ export const CustomerCreate: React.StatelessComponent<{}> = () => (<Messages>{pushMessage => {const handleCreateCustomerSuccess = (data: CreateCustomer) => {- if (- data.customerCreate.errors === null ||- data.customerCreate.errors.length === 0- ) {+ if (data.customerCreate.errors.length === 0) {pushMessage({text: i18n.t("Customer created", {context: "notification"diff --git a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsxindex 552cf5267b..d9c151fdde 100644--- a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx+++ b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx@@ -36,10 +36,7 @@ export const CustomerDetailsView: React.StatelessComponent<<Messages>{pushMessage => {const handleCustomerUpdateSuccess = (data: UpdateCustomer) => {- if (- data.customerUpdate.errors === null ||- data.customerUpdate.errors.length === 0- ) {+ if (data.customerUpdate.errors.length === 0) {pushMessage({text: i18n.t("Customer updated", {context: "notification"@@ -48,10 +45,7 @@ export const CustomerDetailsView: React.StatelessComponent<}};const handleCustomerRemoveSuccess = (data: RemoveCustomer) => {- if (- data.customerDelete.errors === null ||- data.customerDelete.errors.length === 0- ) {+ if (data.customerDelete.errors.length === 0) {pushMessage({text: i18n.t("Customer removed", {context: "notification"diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsxindex 2c2c7361f7..e97c36c37d 100644--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx@@ -60,10 +60,7 @@ export const ProductTypeUpdate: React.StatelessComponent<const handleAttributeCreateSuccess = (data: AttributeCreate) => {- if (- !data.attributeCreate.errors ||- data.attributeCreate.errors.length === 0- ) {+ if (data.attributeCreate.errors.length === 0) {pushMessage({text: i18n.t("Attribute created", {context: "notification"@@ -91,10 +88,7 @@ export const ProductTypeUpdate: React.StatelessComponent<const handleAttributeUpdateSuccess = (data: AttributeUpdate) => {- if (- !data.attributeUpdate.errors ||- data.attributeUpdate.errors.length === 0- ) {+ if (data.attributeUpdate.errors.length === 0) {pushMessage({text: i18n.t("Attribute updated", {context: "notification"diff --git a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx b/saleor/static/dashboard-next/products/views/ProductImage/index.tsxindex b000f3e04c..e6d62ffb14 100644--- a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx+++ b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx@@ -32,10 +32,7 @@ export const ProductImage: React.StatelessComponent<ProductImageProps> = ({{navigate => {const handleBack = () => navigate(productUrl(productId));const handleUpdateSuccess = (data: ProductImageUpdate) => {- if (- data.productImageUpdate &&- data.productImageUpdate.errors.length === 0- ) {+ if (data.productImageUpdate.errors.length === 0) {pushMessage({ text: "Saved changes" });}};diff --git a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsxindex 3f47e8ba83..e26dc74534 100644--- a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx+++ b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx@@ -44,10 +44,7 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({>{({ data, loading: productLoading }) => {const handleCreateSuccess = (data: VariantCreate) => {- if (- data.productVariantCreate.errors === null ||- data.productVariantCreate.errors.length === 0- ) {+ if (data.productVariantCreate.errors.length === 0) {pushMessage({ text: i18n.t("Product created") });navigate(productVariantEditUrl(