-
Notifications
You must be signed in to change notification settings - Fork 69
Conversation
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.
Looks good @aks- , tested it out and everything works. The code is okay as well, except for the copy & paste job with the sparse data which is too much common code. Please extract that into a separate logic.
app/actions/index.js
Outdated
for (const con of dat.network.connections) { | ||
con.removeAllListeners() | ||
} | ||
dat.stats.removeAllListeners() |
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.
While it seems necessary that we do this, I kinda thought that dat.close()
should do that 🤔
app/actions/index.js
Outdated
|
||
dispatch(updateState(dat)) | ||
|
||
if (!paused) { |
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.
Paused is always false!
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.
+1
app/actions/index.js
Outdated
dispatch({ type: 'DAT_METADATA', key, metadata }) | ||
}) | ||
|
||
const walk = () => { |
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.
This seems (unnecessarily) copy & pasted from addDat. Please extract into common code.
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.
+1
app/actions/index.js
Outdated
dispatch({ type: 'DAT_METADATA', key, metadata }) | ||
}) | ||
|
||
const walk = () => { |
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.
+1
app/actions/index.js
Outdated
|
||
dispatch(updateState(dat)) | ||
|
||
if (!paused) { |
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.
+1
app/components/download.js
Outdated
<div className='flex ml2'> | ||
<GreenButton | ||
onClick={() => { | ||
addDat({ key: dat.key, path: dat.path, paused: false }) |
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 should default paused
to false
this still needs some work, I understand it's not an easy case |
@juliangruber oh, you'd done it, i was just getting to it 🙌 |
app/actions/index.js
Outdated
@@ -134,8 +128,6 @@ export const downloadSparseDat = ({ key }) => dispatch => { | |||
dispatch(updateState(dat)) | |||
joinNetwork(dat)(dispatch) | |||
updateConnections(dat)(dispatch) | |||
|
|||
dats[key] = { dat, path, opts } |
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.
@juliangruber how do you remove this dat and close it when you click cancel download if you don't keep reference to it somewhere?
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.
you're right, I misread the code
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.
will fix!
ok, sorry about that, unbroke it now |
app/actions/index.js
Outdated
@@ -33,6 +33,106 @@ export const createDat = () => dispatch => { | |||
addDat({ path })(dispatch) | |||
} | |||
|
|||
export const showDownloadScreen = key => ({ |
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.
what do you think about merging this action with downloadSparseDat
?
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.
@juliangruber you mean merge the logic of showDownloadScreen
into downloadSparseDat
? I kept it separate because they do two different things? one opens up the screen and second one initiates the download of dat info.
3a44f4a
to
af328a1
Compare
@martinheidegger i checked it out... you mentioned there issues mentioned below
|
@aks- on point 3, I guess you could iterate through existing dats and see if one still exists with that id. |
@Karissa right, but what action do we take once we find out that one we are trying to download already exist. don't we have to notify user of that? |
@martinheidegger can you please take a look at this one again? i think we can merge it |
Now this PR contains problems if the same dat is downloaded twice. I think that is the last issue before we should merge it to react?! |
@martinheidegger that sounds right, tomorrow i'm travelling, i can work on it day after tomorrow 👍 |
That review is based on a old version.
2f81ef0
to
38a5b8e
Compare
ecedcbd
to
472cf38
Compare
…load # Conflicts: # app/actions/index.js # app/components/table-row.js # app/reducers/index.js
@AtuyL thank you for the fixes, would you mind to review this PR officially ;) |
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.
Code looks good to me.
No description provided.