Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[redesign] Publish improvements #1040

Merged
merged 5 commits into from
Mar 1, 2018
Merged

[redesign] Publish improvements #1040

merged 5 commits into from
Mar 1, 2018

Conversation

neb-b
Copy link

@neb-b neb-b commented Feb 23, 2018

LET THERE BE REDUX

Changes

Moved publish form values to redux
Move pending publish logic to redux

Issues

There are a few minor bugs but I would rather file those as existing issues and keep moving forward.

  • I am having issues with publishing under a channel but Tom can successfully do it (just my machine? I'm seeing some certificate error)
  • A few times Tom and I have seen "insufficient funds" errors from the daemon even if you have enough funds (possibly an issue with the number input or the value being coerced to a string)

Additional comments

Not super happy with the types. It feels like a lot of duplication. Additionally I'm just keeping the types in the reducer file, until Akinwale's PR to see how he goes about that.

@neb-b neb-b self-assigned this Feb 23, 2018
@neb-b neb-b force-pushed the redesign-wip branch 4 times, most recently from 0e6c6d9 to d5dc21d Compare February 27, 2018 05:31

let prefillClaim;
if (id) {
prefillClaim = selectClaimById(id)(state);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm probably going to change this and have whoever links to the publish page be responsible for populating the form before navigating. Currently there can be issues with this if you navigate away from the form and come back to an edit.

possibly

// file page
populatePublishForm(fileInfo);
doNavigate('/publish')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@kauffj kauffj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much feedback as I could give before app meeting deadline... still didn't actually run the code and didn't quite finish.

/>
<Button
alt
icon="Clipboard"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constants/icons or decide we don't deem this necessary

};

export class FormField extends React.PureComponent<Props> {
render() {
const { render, label, prefix, postfix, error, helper, name, type, children, stretch, ...inputProps } = this.props;

// Allow a type prop to determine the input or more customizability with a render prop
let Input;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why capital? To represent a JSX element?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was capital when I had the render function. Now that I removed it I'll set it back to lowercase.

let isResolvingUri;

// If a publish is pending, don't bother with this because props.uri isn't the complete uri at that moment
if (!props.pending) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pass pending in rather than select it from Redux?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

value?: {
publisherSignature: {
certificateId: string,
}
},
metadata: {
metadata?: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this metadata? because the API is inconsistent about returning metadata? In general, I'm in favor of consistent signatures that include null or otherwise empty values (e.g. []), rather than omitting fields entirely.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That part specifically is for pending publishes. A pending publish won't have the metadata object. Maybe the issue is not keeping it the same. I know there was a lot of code to build an actual dummy claim in lbry.js, currently pendingPublishes[0] is the payload we send to lbry.publish

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm going to add the dummy claim stuff back inside the pending publish. I ran into a couple issues with it, and I'm sure I will only run into more

@@ -70,8 +71,9 @@ class FileList extends React.PureComponent<Props, State> {
getChannelSignature = (fileInfo: FileInfo) => {
if (fileInfo.value) {
return fileInfo.value.publisherSignature.certificateId;
} else if (fileInfo.metadata) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here that this can have two different data structures?

If the daemon is inconsistent with it's responses, I'd like to get issues opened to clean this up.

const channel = event.target.value;

if (channel === 'new') {
this.setState({ addingChannel: true });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the publish page generally retains state via Redux, will this internal component state be a potential source of error or confusion?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a good component to test out your idea, just to see how it works in practice. I'll keep it as is for now, but look into refactoring when we add it to the "Your publishes" page, or somewhere else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<option key="anonymous" value="anonymous">
{__('Anonymous')}
</option>
{channels.map(({ name }) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be cool if this defaulted to the last channel you published with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea

* needed to make a dummy claim or file info object.
*/
let pendingId = 0;
function savePendingPublish({ name, channelName }) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏


let prefillClaim;
if (id) {
prefillClaim = selectClaimById(id)(state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

errorCallback(err);
}
);
Lbry.publishContent = (params, publishedCallback, errorCallback) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can drop this and just use lbry.publish(...).then(...) in code.

@neb-b neb-b requested a review from kauffj February 28, 2018 01:22
@lbry-bot lbry-bot assigned kauffj and unassigned kauffj Feb 28, 2018
@neb-b
Copy link
Author

neb-b commented Feb 28, 2018

@kauffj Realized I didn't add contstants for 'anonymous' and 'new' for channel creation. And also forgot to fix the price placeholder after your comments. I'll add those.

@neb-b neb-b merged commit 74ea22c into redesign Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants