Use uri from props instead of location

- which was causing it to fail on popout chat for example
This commit is contained in:
Rafael 2022-01-26 08:50:43 -03:00 committed by Thomas Zarebczan
parent cab4b3aba8
commit e4d5d69524
3 changed files with 6 additions and 3 deletions

View file

@ -85,6 +85,7 @@ export function CommentCreate(props: Props) {
settingsByChannelId, settingsByChannelId,
shouldFetchComment, shouldFetchComment,
supportDisabled, supportDisabled,
uri,
disableInput, disableInput,
createComment, createComment,
doFetchCreatorSettings, doFetchCreatorSettings,
@ -492,6 +493,7 @@ export function CommentCreate(props: Props) {
textAreaMaxLength={isLivestream ? FF_MAX_CHARS_IN_LIVESTREAM_COMMENT : FF_MAX_CHARS_IN_COMMENT} textAreaMaxLength={isLivestream ? FF_MAX_CHARS_IN_LIVESTREAM_COMMENT : FF_MAX_CHARS_IN_COMMENT}
type={!SIMPLE_SITE && advancedEditor && !isReply ? 'markdown' : 'textarea'} type={!SIMPLE_SITE && advancedEditor && !isReply ? 'markdown' : 'textarea'}
value={commentValue} value={commentValue}
uri={uri}
/> />
</> </>
)} )}

View file

@ -15,6 +15,7 @@ import type { ElementRef, Node } from 'react';
const TextareaWithSuggestions = lazyImport(() => import('component/textareaWithSuggestions' /* webpackChunkName: "suggestions" */)); const TextareaWithSuggestions = lazyImport(() => import('component/textareaWithSuggestions' /* webpackChunkName: "suggestions" */));
type Props = { type Props = {
uri?: string,
affixClass?: string, // class applied to prefix/postfix label affixClass?: string, // class applied to prefix/postfix label
autoFocus?: boolean, autoFocus?: boolean,
blockWrap: boolean, blockWrap: boolean,
@ -68,6 +69,7 @@ export class FormField extends React.PureComponent<Props> {
render() { render() {
const { const {
uri,
affixClass, affixClass,
autoFocus, autoFocus,
blockWrap, blockWrap,
@ -252,6 +254,7 @@ export class FormField extends React.PureComponent<Props> {
) : ( ) : (
<React.Suspense fallback={null}> <React.Suspense fallback={null}>
<TextareaWithSuggestions <TextareaWithSuggestions
uri={uri}
type={type} type={type}
id={name} id={name}
maxLength={textAreaMaxLength || FF_MAX_CHARS_DEFAULT} maxLength={textAreaMaxLength || FF_MAX_CHARS_DEFAULT}

View file

@ -6,12 +6,10 @@ import { MAX_LIVESTREAM_COMMENTS } from 'constants/livestream';
import { selectChannelMentionData } from 'redux/selectors/comments'; import { selectChannelMentionData } from 'redux/selectors/comments';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import replaceAll from 'core-js-pure/features/string/replace-all';
import TextareaWithSuggestions from './view'; import TextareaWithSuggestions from './view';
const select = (state, props) => { const select = (state, props) => {
const { pathname } = props.location; const { uri } = props;
const uri = `lbry:/${replaceAll(pathname, ':', '#')}`;
const maxComments = props.isLivestream ? MAX_LIVESTREAM_COMMENTS : -1; const maxComments = props.isLivestream ? MAX_LIVESTREAM_COMMENTS : -1;
const data = selectChannelMentionData(state, uri, maxComments); const data = selectChannelMentionData(state, uri, maxComments);