fix(StorePage/index.tsx): fix key prop in MarketCardComponent to use unique identifier from item instead of index to avoid rendering issues
feat(StorePage/index.tsx): add conditional check to getSavedComponents() if hasApiKey is true to only fetch saved components when API key is available
This commit is contained in:
parent
630fabc328
commit
e9d9891d75
1 changed files with 5 additions and 2 deletions
|
|
@ -49,6 +49,9 @@ export default function StorePage(): JSX.Element {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleGetComponents();
|
handleGetComponents();
|
||||||
|
if (hasApiKey) {
|
||||||
|
getSavedComponents();
|
||||||
|
}
|
||||||
}, [
|
}, [
|
||||||
searchText,
|
searchText,
|
||||||
tabActive,
|
tabActive,
|
||||||
|
|
@ -266,11 +269,11 @@ export default function StorePage(): JSX.Element {
|
||||||
|
|
||||||
<div className="grid w-full gap-4 md:grid-cols-2 lg:grid-cols-3">
|
<div className="grid w-full gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||||
{!loading || searchData.length !== 0 ? (
|
{!loading || searchData.length !== 0 ? (
|
||||||
searchData.map((item, idx) => {
|
searchData.map((item) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MarketCardComponent
|
<MarketCardComponent
|
||||||
key={idx}
|
key={item.id}
|
||||||
data={item}
|
data={item}
|
||||||
authorized={!loadingSaved}
|
authorized={!loadingSaved}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue