Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/reducing requests #76

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Fix/reducing requests #76

wants to merge 6 commits into from

Conversation

SlaVR7
Copy link
Collaborator

@SlaVR7 SlaVR7 commented Mar 30, 2024

  1. Removed all duplicate API requests on all pages.

Product Page:

  1. completely rewrote the component, removed crutches like sessionStorage, replaced the scroll listener with an IntersectionObserver for endless loading
  2. Instead of gif spinner, I made it on CSS to speed up
  3. Change the logic of generating query queries for the product page.
  4. Removed DOM manipulation (querySelector, adding/removing classes)

SignIn and SignUp pages:
Removed the horror that was, replaced it with useForm and Yup.

Copy link

vercel bot commented Mar 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rss-soap-shop ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2024 9:39am

Copy link
Owner

@anastakozz anastakozz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happy to finish this review after you fix the problem with getCart in App.tsx that crashes the app. Though, Forms look really nice)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like it's not for committing

"format": "prettier --log-level warn --write 'src/**/*.{ts,tsx,json}'",
"win-format": "prettier --log-level warn --write 'find src -type f \\( -name \"*.js\" -o -name \"*.jsx\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.css\" -o -name \"*.md\" -o -name \"*.json\" \\) -exec prettier --write {} \\;'",
"lint:fix": "eslint --fix src/**/*.{ts,tsx}",
"format:fix": "prettier --write src/.",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yessss

import HomePage from './pages/homePage';
import ProductsPage from './pages/productsPage';
import AboutPage from './pages/aboutPage';
import CartPage from './pages/cartPage';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you prefer not using aliases here?

import LogoutIcon from '@icons/logoutIcon';
import LogoutIconDark from '@icons/logoutIconDark';
import { tokenNames } from '@enums';
import ProfileIcon from '../../../icons/profileIcon';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aliases?

}
};
parentCategoryName === openedCategory ? setRotationAngle('90') : setRotationAngle('-90');
}, [openedCategory, parentCategoryName]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice)

})
.catch(err => {
console.error(err);
if (err.response.data.error == 'invalid_customer_account_credentials') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was implemented the same way previously, but maybe you could improve it slightly and add an error message for any other types of errors, for example "something went wrong"... In case when request fails, there is no error message now and the page looks unfinished

.catch(err => console.log(err));
async function setToken() {
if (!isLoggedIn && !isSeenBefore) {
await setAnonymousToken()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check getCart function and add errorHandling. If there is no token in localStorage app crashes

@@ -0,0 +1,62 @@
import { Dropdown } from './Dropdown';
import { ControlledInput } from './ControlledInput';
import { AddressProps } from '../../../lib/interfaces';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aliases

import { IControlledInputContainer } from '../../../lib/interfaces';
import { ValidFieldNames } from '../../../lib/types';
import { HidePassword } from '../../../icons/hidePassword';
import { ShowPassword } from '../../../icons/showPassword';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aliases)

import React, { ChangeEvent, useState } from 'react';
import { IControlledInputContainer } from '../../../lib/interfaces';
import { ValidFieldNames } from '../../../lib/types';
import { HidePassword } from '../../../icons/hidePassword';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would please change naming for this icons : like HidePasswordIcon or smth. Now it looks like a function, not a component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants