-
Notifications
You must be signed in to change notification settings - Fork 1k
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
EDU-591: Product Editorial - Blueprints - React Gen 2 #3992
base: main
Are you sure you want to change the base?
Conversation
|
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
11707119 | Triggered | Generic High Entropy Secret | 6b3f133 | packages/sdks/snippets/react/src/routes/blueprints/ProductEditorial.tsx | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
View your CI Pipeline Execution ↗ for commit ca58d42.
☁️ Nx Cloud last updated this comment at |
removed all the unused code making react code clear
49ca2e9
to
ca58d42
Compare
@@ -0,0 +1,35 @@ | |||
type Product = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can export the type from here and use it to type the useState in ProductEditorial.tsx
-> <Product | null>
type Product = { | |
export type Product = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left a minor comment
useEffect(() => { | ||
Promise.all([ | ||
fetch(`https://fakestoreapi.com/products/${id}`).then((res) => | ||
res.json() | ||
), | ||
fetchOneEntry({ | ||
model: MODEL_NAME, | ||
apiKey: API_KEY, | ||
userAttributes: { urlPath: window.location.pathname }, | ||
}), | ||
]).then(([productData, editorialData]) => { | ||
setProduct(productData); | ||
setEditorial(editorialData); | ||
}); | ||
}, [id]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.all
is an unnecessary complication. There is nothing gained from running the promises together- the hook is dependent on
id
but only one of the calls is tied to theid
should be two separate hooks:
useEffect(() => { | |
Promise.all([ | |
fetch(`https://fakestoreapi.com/products/${id}`).then((res) => | |
res.json() | |
), | |
fetchOneEntry({ | |
model: MODEL_NAME, | |
apiKey: API_KEY, | |
userAttributes: { urlPath: window.location.pathname }, | |
}), | |
]).then(([productData, editorialData]) => { | |
setProduct(productData); | |
setEditorial(editorialData); | |
}); | |
}, [id]); | |
useEffect(() => { | |
fetch(`https://fakestoreapi.com/products/${id}`) | |
.then((res) => res.json()) | |
.then((productData) => { | |
setProduct(productData); | |
}); | |
}, [id]); | |
useEffect(() => { | |
fetchOneEntry({ | |
model: MODEL_NAME, | |
apiKey: API_KEY, | |
userAttributes: { urlPath: window.location.pathname }, | |
}).then((editorialData) => { | |
setEditorial(editorialData); | |
}); | |
}, []); |
Description
This PR adds the Product editorial code in React to the Blueprints. This is related to the ticket.
We have angular code in the blueprints, but other framework code needs to be added, and this ticket addresses that.