Publish: Make 'Channel' setting persistent.

## Issue
Users are annoyed with the constant reset of the 'channel' setting in the Publish page.

## Changes
1. Revert the previous attempt in ff7b4092. The `usePersistedState` method is bad, as it will clash with the Redux value.
2. Implemented the persistence in Redux -- requires "https://github.com/lbryio/lbry-redux/pull/347".
This commit is contained in:
infiinte-persistence 2020-08-14 18:26:20 +08:00 committed by Sean Yesmunt
parent b58c9709e2
commit f3362c4e59
4 changed files with 4 additions and 19 deletions

View file

@ -136,7 +136,7 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#7df96d47671308c09db0a28892dbbfd6486d81f4",
"lbry-redux": "lbryio/lbry-redux#05b949d470dd1f3436b45ab1e252c0dcc0ae9a3f",
"lbryinc": "lbryio/lbryinc#cff5dd60934c4c6080e135f47ebbece1548c658c",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -77,7 +77,6 @@ type Props = {
// Add back type
updatePublishForm: any => void,
checkAvailability: string => void,
onChannelChange: string => void,
ytSignupPending: boolean,
};
@ -114,7 +113,6 @@ function PublishForm(props: Props) {
publish,
disabled = false,
checkAvailability,
onChannelChange,
ytSignupPending,
} = props;
@ -209,7 +207,6 @@ function PublishForm(props: Props) {
}, [name, channel, resolveUri, updatePublishForm, checkAvailability]);
function handleChannelNameChange(channel) {
onChannelChange(channel);
updatePublishForm({ channel });
}

View file

@ -5,7 +5,6 @@ import Page from 'component/page';
import Yrbl from 'component/yrbl';
import LbcSymbol from 'component/common/lbc-symbol';
import RewardAuthIntro from 'component/rewardAuthIntro';
import usePersistedState from 'effects/use-persisted-state';
type Props = {
balance: number,
@ -15,8 +14,6 @@ type Props = {
function PublishPage(props: Props) {
const { balance } = props;
const [channel, setChannel] = usePersistedState('publish-channel', '');
function scrollToTop() {
const mainContent = document.querySelector('main');
if (mainContent) {
@ -24,10 +21,6 @@ function PublishPage(props: Props) {
}
}
function handleChannelChange(channel) {
setChannel(channel);
}
return (
<Page>
{balance === 0 ? (
@ -62,12 +55,7 @@ function PublishPage(props: Props) {
</div>
</Fragment>
) : (
<PublishForm
scrollToTop={scrollToTop}
disabled={balance === 0}
channel={channel}
onChannelChange={handleChannelChange}
/>
<PublishForm scrollToTop={scrollToTop} disabled={balance === 0} />
)}
</Page>
);

View file

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