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 SelectChannel from './view';
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';
const select = (state) => ({
myChannelClaims: selectMyChannelClaims(state),
fetchingChannels: selectFetchingMyChannels(state),
activeChannelClaim: selectActiveChannelClaim(state),
activeChannelId: selectActiveChannelId(state),
});
const perform = (dispatch) => ({

View file

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