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

View file

@ -15,6 +15,7 @@ import type { ElementRef, Node } from 'react';
const TextareaWithSuggestions = lazyImport(() => import('component/textareaWithSuggestions' /* webpackChunkName: "suggestions" */));
type Props = {
uri?: string,
affixClass?: string, // class applied to prefix/postfix label
autoFocus?: boolean,
blockWrap: boolean,
@ -68,6 +69,7 @@ export class FormField extends React.PureComponent<Props> {
render() {
const {
uri,
affixClass,
autoFocus,
blockWrap,
@ -252,6 +254,7 @@ export class FormField extends React.PureComponent<Props> {
) : (
<React.Suspense fallback={null}>
<TextareaWithSuggestions
uri={uri}
type={type}
id={name}
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 { selectShowMatureContent } from 'redux/selectors/settings';
import { withRouter } from 'react-router';
import replaceAll from 'core-js-pure/features/string/replace-all';
import TextareaWithSuggestions from './view';
const select = (state, props) => {
const { pathname } = props.location;
const uri = `lbry:/${replaceAll(pathname, ':', '#')}`;
const { uri } = props;
const maxComments = props.isLivestream ? MAX_LIVESTREAM_COMMENTS : -1;
const data = selectChannelMentionData(state, uri, maxComments);