Skip to content

Commit

Permalink
fix: renterd file health slab keys
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Apr 23, 2024
1 parent 9059ef4 commit 703761a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-horses-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Fixed an issue where file health slab keys were showing up as repeated and incorrect. Closes https://github.com/SiaFoundation/web/issues/596
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ export function FilesHealthColumnContents({
const slabs = sortBy(
obj.data.object.slabs?.map((s) => ({
...s.slab,
key: `${s.offset}${s.length}${s.slab.key}`,
// id is for use as a unique React key.
// slab key is not necessarily unique. e.g. an object uploaded with tiny
// multipart uploads might reference the same slab over and over but at
// different offsets and lengths. So we should not assume that they are
// always unique.
id: `${s.offset}${s.length}${s.slab.key}`,
isPartialSlab: !!s.slab.shards,
contractSetShards: s.slab.shards?.length
? computeSlabContractSetShards({
Expand All @@ -79,7 +84,7 @@ export function FilesHealthColumnContents({
totalShards={slabs.find((s) => s.shards)?.shards.length}
>
{slabs.map((slab) => (
<div key={slab.key} className="flex justify-between gap-2">
<div key={slab.id} className="flex justify-between gap-2">
<Text
size="12"
color="subtle"
Expand Down

0 comments on commit 703761a

Please sign in to comment.