Use the lighter activeChannelId

- No need to generate the full claim since we are only using the ID.
This commit is contained in:
infinite-persistence 2021-12-02 20:59:34 +08:00
parent 36c10a9c78
commit 8eff3dca21
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 7 additions and 7 deletions

View file

@ -1,13 +1,13 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import SelectChannel from './view'; import SelectChannel from './view';
import { selectMyChannelClaims, selectFetchingMyChannels } from 'redux/selectors/claims'; import { selectMyChannelClaims, selectFetchingMyChannels } from 'redux/selectors/claims';
import { selectActiveChannelClaim } from 'redux/selectors/app'; import { selectActiveChannelId } from 'redux/selectors/app';
import { doSetActiveChannel } from 'redux/actions/app'; import { doSetActiveChannel } from 'redux/actions/app';
const select = (state) => ({ const select = (state) => ({
myChannelClaims: selectMyChannelClaims(state), myChannelClaims: selectMyChannelClaims(state),
fetchingChannels: selectFetchingMyChannels(state), fetchingChannels: selectFetchingMyChannels(state),
activeChannelClaim: selectActiveChannelClaim(state), activeChannelId: selectActiveChannelId(state),
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({

View file

@ -7,8 +7,8 @@ type Props = {
label: string, label: string,
myChannelClaims: ?Array<ChannelClaim>, myChannelClaims: ?Array<ChannelClaim>,
injected: ?Array<string>, injected: ?Array<string>,
activeChannelClaim: ?ChannelClaim, activeChannelId: ?string,
setActiveChannel: string => void, setActiveChannel: (string) => void,
fetchingChannels: boolean, fetchingChannels: boolean,
}; };
@ -19,7 +19,7 @@ function SelectChannel(props: Props) {
label, label,
injected = [], injected = [],
tiny, tiny,
activeChannelClaim, activeChannelId,
setActiveChannel, setActiveChannel,
} = props; } = props;
@ -36,7 +36,7 @@ function SelectChannel(props: Props) {
labelOnLeft={tiny} labelOnLeft={tiny}
type={tiny ? 'select-tiny' : 'select'} type={tiny ? 'select-tiny' : 'select'}
onChange={handleChannelChange} onChange={handleChannelChange}
value={activeChannelClaim && activeChannelClaim.claim_id} value={activeChannelId}
disabled={fetchingChannels} disabled={fetchingChannels}
> >
{fetchingChannels ? ( {fetchingChannels ? (
@ -50,7 +50,7 @@ function SelectChannel(props: Props) {
</option> </option>
))} ))}
{injected && {injected &&
injected.map(item => ( injected.map((item) => (
<option key={item} value={item}> <option key={item} value={item}>
{item} {item}
</option> </option>