mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 09:00:06 +00:00
fix for share attachment loop
This commit is contained in:
parent
0d09122c3f
commit
7a4cf10614
@ -29,11 +29,15 @@ export function Content({share, closeAll, openConversation, textCard}: { share:
|
||||
});
|
||||
const cards = state.sealSet && sealedTopic ? state.sealable : state.connected;
|
||||
|
||||
const select = (cardId: string, channelId: string) => {
|
||||
const select = (cardId: string | null, channelId: string) => {
|
||||
if (share) {
|
||||
const { filePath, mimeType } = share;
|
||||
actions.setSharing({ cardId, channelId, filePath, mimeType });
|
||||
}
|
||||
open(cardId, channelId);
|
||||
}
|
||||
|
||||
const open = (cardId: string | null, channelId: string) => {
|
||||
actions.setFocus(cardId, channelId);
|
||||
openConversation();
|
||||
}
|
||||
@ -120,8 +124,8 @@ export function Content({share, closeAll, openConversation, textCard}: { share:
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({item}) => {
|
||||
const {sealed, focused, hosted, unread, imageUrl, subject, message} = item;
|
||||
const open = () => {
|
||||
select(item.cardId, item.channelId);
|
||||
const choose = () => {
|
||||
open(item.cardId, item.channelId);
|
||||
};
|
||||
const Wrap = (state.layout === 'large' && focused) ? Surface : View;
|
||||
return (
|
||||
@ -131,7 +135,7 @@ export function Content({share, closeAll, openConversation, textCard}: { share:
|
||||
...styles.channel,
|
||||
borderColor: theme.colors.outlineVariant,
|
||||
}}
|
||||
select={open}
|
||||
select={choose}
|
||||
unread={unread}
|
||||
sealed={sealed}
|
||||
hosted={hosted}
|
||||
|
@ -7,7 +7,7 @@ import { useSelector } from './useSelector.hook';
|
||||
import { ChannelParams } from '../content/Content';
|
||||
import { Channel } from '../channel/Channel';
|
||||
|
||||
export function Selector({ share, selected, channels }: { share: { filePath: string, mimeType: string }, selected: (cardId: string, channelId: string)=>void, channels: ChannelParams[] }) {
|
||||
export function Selector({ share, selected, channels }: { share: { filePath: string, mimeType: string }, selected: (cardId: string | null, channelId: string)=>void, channels: ChannelParams[] }) {
|
||||
const { state, actions } = useSelector();
|
||||
const [show, setShow] = useState(false);
|
||||
const theme = useTheme();
|
||||
@ -21,9 +21,12 @@ export function Selector({ share, selected, channels }: { share: { filePath: str
|
||||
}, [share]);
|
||||
|
||||
const select = () => {
|
||||
const { cardId, channelId } = topic;
|
||||
setShow(false);
|
||||
selected(cardId, channelId);
|
||||
if (topic) {
|
||||
const { cardId, channelId } = topic;
|
||||
setShow(false);
|
||||
setTopic(null);
|
||||
selected(cardId, channelId);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user