Skip to content

Fix/reducing requests#76

Open
SlaVR7 wants to merge 6 commits into
developfrom
fix/reducing-requests
Open

Fix/reducing requests#76
SlaVR7 wants to merge 6 commits into
developfrom
fix/reducing-requests

Conversation

@SlaVR7

@SlaVR7 SlaVR7 commented Mar 30, 2024

Copy link
Copy Markdown
Collaborator
  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.

@vercel

vercel Bot commented Mar 30, 2024

Copy link
Copy Markdown

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

@anastakozz anastakozz left a comment

Copy link
Copy Markdown
Owner

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)

Comment thread .idea/.gitignore

Copy link
Copy Markdown
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

Comment thread rs-soap-shop/package.json
"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
Copy Markdown
Owner

Choose a reason for hiding this comment

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

yessss

Comment thread rs-soap-shop/src/App.tsx
import HomePage from './pages/homePage';
import ProductsPage from './pages/productsPage';
import AboutPage from './pages/aboutPage';
import CartPage from './pages/cartPage';

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread rs-soap-shop/src/App.tsx
.catch(err => console.log(err));
async function setToken() {
if (!isLoggedIn && !isSeenBefore) {
await setAnonymousToken()

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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