Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 872251d

Browse files
committed
compensate kvstore previews for no e.hash
1 parent 787d1ef commit 872251d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/views/Database.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ function ProgramView () {
3131
const { programName, dbName } = useParams()
3232
const [appState, dispatch] = useStateValue()
3333
const history = useHistory()
34-
const [entry, setEntry] = React.useState(null)
34+
const [index, setIndex] = React.useState(null)
3535
const [loading, setLoading] = React.useState(false)
3636
const [address] = React.useState(`/orbitdb/${programName}/${dbName}`)
3737

38-
const handleSelect = (e) => {
39-
setEntry(e !== entry ? e : null)
38+
const handleSelect = (idx) => {
39+
setIndex(idx !== index ? idx : null)
4040
}
4141

4242
const handleBack = () => {
@@ -140,14 +140,14 @@ function ProgramView () {
140140
marginY={majorScale(2)}
141141
/>
142142
: appState.entries.map((e, idx) => {
143-
console.log(e)
143+
idx += 1
144144
return (
145145
<div key={idx}>
146146
<Pane>
147-
<Text userSelect='none' cursor='pointer' onClick={() => handleSelect(e)}>{JSON.stringify(e.payload.value, null, 2)}</Text>
147+
<Text userSelect='none' cursor='pointer' onClick={() => handleSelect(idx)}>{JSON.stringify(e.payload.value, null, 2)}</Text>
148148
</Pane>
149149
<Pane>
150-
{entry && entry.hash === e.hash
150+
{index && idx === index
151151
? <Pre
152152
maxWidth={majorScale(96)}
153153
overflow='auto'

0 commit comments

Comments
 (0)