fix empty reducer and fix empty channelSelect creation (#4000)

This commit is contained in:
jessopb 2020-04-15 17:58:59 -04:00 committed by GitHub
parent 48b071513b
commit 4031346eb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View file

@ -130,7 +130,7 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#387aa8d0a8e9383f4f27c991bfd9c37fdb14a779",
"lbry-redux": "lbryio/lbry-redux#df043f3ef6076b52cec11be76069e0c7c9c19e0a",
"lbryinc": "lbryio/lbryinc#12aefaa14343d2f3eac01f2683701f58e53f1848",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -4,10 +4,10 @@ import React, { useEffect, useState } from 'react';
import classnames from 'classnames';
import { FormField, Form } from 'component/common/form';
import Button from 'component/button';
import ChannelSection from 'component/selectChannel';
import ChannelSelection from 'component/selectChannel';
import usePersistedState from 'effects/use-persisted-state';
import * as MODALS from 'constants/modal_types';
import I18nMessage from '../i18nMessage/view';
import I18nMessage from 'component/i18nMessage';
type Props = {
commentingEnabled: boolean,
@ -94,7 +94,7 @@ export function CommentCreate(props: Props) {
return (
<Form onSubmit={handleSubmit} className={classnames('comment__create', { 'comment__create--reply': isReply })}>
{!isReply && <ChannelSection channel={channel} hideAnon onChannelChange={handleChannelChange} />}
{!isReply && <ChannelSelection channel={channel} hideAnon onChannelChange={handleChannelChange} />}
<FormField
disabled={channel === CHANNEL_NEW}
type="textarea"

View file

@ -23,7 +23,7 @@ type State = {
addingChannel: boolean,
};
class ChannelSection extends React.PureComponent<Props, State> {
class ChannelSelection extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
@ -46,6 +46,13 @@ class ChannelSection extends React.PureComponent<Props, State> {
}
}
componentDidUpdate() {
const { channels } = this.props;
if (!channels) {
this.setState({ addingChannel: true });
}
}
handleChannelChange(event: SyntheticInputEvent<*>) {
const { onChannelChange } = this.props;
const channel = event.target.value;
@ -105,4 +112,4 @@ class ChannelSection extends React.PureComponent<Props, State> {
}
}
export default ChannelSection;
export default ChannelSelection;

View file

@ -6139,9 +6139,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#387aa8d0a8e9383f4f27c991bfd9c37fdb14a779:
lbry-redux@lbryio/lbry-redux#df043f3ef6076b52cec11be76069e0c7c9c19e0a:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/387aa8d0a8e9383f4f27c991bfd9c37fdb14a779"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/df043f3ef6076b52cec11be76069e0c7c9c19e0a"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"