Skip to content

Commit

Permalink
added key to map items
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijv256 committed Oct 26, 2023
1 parent 6b62f09 commit cf29105
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/Components/Facility/LiveFeedScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export default function LiveFeedScreen({ facilityId }: Props) {

setTotalCount(entries.length);
setAssetList(entries);
console.log("assetList", entries);
}
fetchData();
}, [
Expand Down Expand Up @@ -286,12 +285,9 @@ export default function LiveFeedScreen({ facilityId }: Props) {
</div>
) : (
<div className="mt-1 grid grid-cols-1 gap-2 xl:grid-cols-2 3xl:grid-cols-3">
{assetList.map((asset: any) => (
<div className="text-clip">
<LiveFeedTile
assetId={asset.asset.id}
key={asset.patientAssetBed?.bed.id}
/>
{assetList.map((asset, idx) => (
<div className="text-clip" key={idx}>
<LiveFeedTile assetId={asset.asset.id} key={asset?.bed.id} />
</div>
))}
</div>
Expand Down
5 changes: 0 additions & 5 deletions src/Components/Facility/LiveFeedTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default function LiveFeedTile(props: LiveFeedTileProps) {
const { t } = useTranslation();
const [_isFullscreen, setFullscreen] = useFullscreen();
// const [toggle, setToggle] = useState(false);
console.log("re-rendered");

useEffect(() => {
let loadingTimeout: any;
Expand All @@ -58,7 +57,6 @@ export default function LiveFeedTile(props: LiveFeedTileProps) {
setLoading(true);
console.log("fetching asset");
const assetData: any = await dispatch(getAsset(assetId));
console.log("assetData", assetData);
if (!status.aborted) {
// setLoading(false);
if (!assetData.data)
Expand Down Expand Up @@ -122,14 +120,11 @@ export default function LiveFeedTile(props: LiveFeedTileProps) {
});
};
const getPresets = (asset: any) => {
console.log(asset);
const url = `https://${asset.meta.middleware_hostname}/presets?hostname=${asset.hostname}&port=${asset.port}&username=${asset.username}&password=${asset.password}`;
console.log(url);
axios
.get(url)
.then((resp: any) => {
setPresets(resp.data);
console.log("PRESETS", resp.data);
})
.catch((_ex: any) => {
// console.error("Error while refreshing", ex);
Expand Down

0 comments on commit cf29105

Please sign in to comment.