mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-28 16:01:26 +00:00
fix: multiple pending publishes when editing
This commit is contained in:
parent
66b63a27c7
commit
5489d99099
5 changed files with 28 additions and 16 deletions
|
@ -1,4 +1,3 @@
|
||||||
import React from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import { doResolveUri } from 'redux/actions/content';
|
import { doResolveUri } from 'redux/actions/content';
|
||||||
|
@ -10,12 +9,10 @@ import { selectPendingPublish } from 'redux/selectors/publish';
|
||||||
import FileCard from './view';
|
import FileCard from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
let claim;
|
let pendingPublish;
|
||||||
let fileInfo;
|
if (props.checkPending) {
|
||||||
let metadata;
|
pendingPublish = selectPendingPublish(props.uri)(state);
|
||||||
let isResolvingUri;
|
}
|
||||||
|
|
||||||
const pendingPublish = selectPendingPublish(props.uri)(state);
|
|
||||||
|
|
||||||
const fileCardInfo = pendingPublish || {
|
const fileCardInfo = pendingPublish || {
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
|
|
|
@ -25,6 +25,7 @@ type Props = {
|
||||||
sortByHeight?: boolean,
|
sortByHeight?: boolean,
|
||||||
claimsById: Array<{}>,
|
claimsById: Array<{}>,
|
||||||
fileInfos: Array<FileInfo>,
|
fileInfos: Array<FileInfo>,
|
||||||
|
checkPending?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -138,7 +139,7 @@ class FileList extends React.PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { fileInfos, hideFilter } = this.props;
|
const { fileInfos, hideFilter, checkPending } = this.props;
|
||||||
const { sortBy } = this.state;
|
const { sortBy } = this.state;
|
||||||
const content = [];
|
const content = [];
|
||||||
|
|
||||||
|
@ -166,7 +167,7 @@ class FileList extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
const uri = buildURI(uriParams);
|
const uri = buildURI(uriParams);
|
||||||
|
|
||||||
content.push(<FileCard key={uri} uri={uri} />);
|
content.push(<FileCard key={uri} uri={uri} checkPending={checkPending} />);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectMyClaimsWithoutChannels } from 'redux/selectors/claims';
|
import { selectMyClaimsWithoutChannels } from 'redux/selectors/claims';
|
||||||
import { selectPendingPublishes } from 'redux/selectors/publish';
|
import { selectPendingPublishesLessEdits } from 'redux/selectors/publish';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import { doCheckPendingPublishes } from 'redux/actions/publish';
|
import { doCheckPendingPublishes } from 'redux/actions/publish';
|
||||||
import FileListPublished from './view';
|
import FileListPublished from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
claims: selectMyClaimsWithoutChannels(state),
|
claims: selectMyClaimsWithoutChannels(state),
|
||||||
pendingPublishes: selectPendingPublishes(state),
|
pendingPublishes: selectPendingPublishesLessEdits(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import FileList from 'component/fileList';
|
import FileList from 'component/fileList';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
|
|
||||||
class FileListPublished extends React.PureComponent {
|
type Props = {
|
||||||
|
pendingPublishes: Array<{}>,
|
||||||
|
claims: Array<{}>,
|
||||||
|
checkIfPublishesConfirmed: (Array<{}>) => void,
|
||||||
|
navigate: (string, ?{}) => void,
|
||||||
|
};
|
||||||
|
|
||||||
|
class FileListPublished extends React.PureComponent<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { pendingPublishes, checkIfPublishesConfirmed } = this.props;
|
const { pendingPublishes, checkIfPublishesConfirmed } = this.props;
|
||||||
if (pendingPublishes.length) {
|
if (pendingPublishes.length) {
|
||||||
|
@ -18,7 +26,7 @@ class FileListPublished extends React.PureComponent {
|
||||||
return (
|
return (
|
||||||
<Page notContained>
|
<Page notContained>
|
||||||
{fileInfos.length ? (
|
{fileInfos.length ? (
|
||||||
<FileList fileInfos={fileInfos} sortByHeight />
|
<FileList checkPending fileInfos={fileInfos} sortByHeight />
|
||||||
) : (
|
) : (
|
||||||
<div className="page__empty">
|
<div className="page__empty">
|
||||||
{__("It looks like you haven't published anything to LBRY yet.")}
|
{__("It looks like you haven't published anything to LBRY yet.")}
|
||||||
|
|
|
@ -3,9 +3,15 @@ import { parseURI } from 'lbryURI';
|
||||||
|
|
||||||
const selectState = state => state.publish || {};
|
const selectState = state => state.publish || {};
|
||||||
|
|
||||||
export const selectPendingPublishes = createSelector(selectState, state => {
|
export const selectPendingPublishes = createSelector(
|
||||||
return state.pendingPublishes.map(pendingClaim => ({ ...pendingClaim, pending: true })) || [];
|
selectState,
|
||||||
});
|
state => state.pendingPublishes.map(pendingClaim => ({ ...pendingClaim, pending: true })) || []
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectPendingPublishesLessEdits = createSelector(
|
||||||
|
selectPendingPublishes,
|
||||||
|
pendingPublishes => pendingPublishes.filter(pendingPublish => !pendingPublish.sources)
|
||||||
|
);
|
||||||
|
|
||||||
export const selectPublishFormValues = createSelector(selectState, state => {
|
export const selectPublishFormValues = createSelector(selectState, state => {
|
||||||
const { pendingPublish, ...formValues } = state;
|
const { pendingPublish, ...formValues } = state;
|
||||||
|
|
Loading…
Add table
Reference in a new issue