Page MenuHomePhabricator

D7679.diff
No OneTemporary

D7679.diff

diff --git a/native/avatars/edit-thread-avatar-provider.react.js b/native/avatars/edit-thread-avatar-provider.react.js
--- a/native/avatars/edit-thread-avatar-provider.react.js
+++ b/native/avatars/edit-thread-avatar-provider.react.js
@@ -16,6 +16,8 @@
useServerCall,
} from 'lib/utils/action-utils.js';
+import { activeThreadSelector } from '../navigation/nav-selectors.js';
+import { NavContext } from '../navigation/navigation-context.js';
import { useSelector } from '../redux/redux-utils.js';
export type EditThreadAvatarContextType = {
@@ -26,23 +28,28 @@
const EditThreadAvatarContext: React.Context<?EditThreadAvatarContextType> =
React.createContext<?EditThreadAvatarContextType>();
-const threadAvatarLoadingStatusSelector = createLoadingStatusSelector(
- changeThreadSettingsActionTypes,
- `${changeThreadSettingsActionTypes.started}:avatar`,
-);
-
type Props = {
+children: React.Node,
};
function EditThreadAvatarProvider(props: Props): React.Node {
const { children } = props;
- const dispatchActionPromise = useDispatchActionPromise();
- const changeThreadSettingsCall = useServerCall(changeThreadSettings);
+ const navContext = React.useContext(NavContext);
+ const activeThreadID = React.useMemo(
+ () => activeThreadSelector(navContext) ?? '',
+ [navContext],
+ );
+
const updateThreadAvatarLoadingStatus: LoadingStatus = useSelector(
- threadAvatarLoadingStatusSelector,
+ createLoadingStatusSelector(
+ changeThreadSettingsActionTypes,
+ `${changeThreadSettingsActionTypes.started}:${activeThreadID}:avatar`,
+ ),
);
+ const dispatchActionPromise = useDispatchActionPromise();
+ const changeThreadSettingsCall = useServerCall(changeThreadSettings);
+
const threadAvatarSaveInProgress =
updateThreadAvatarLoadingStatus === 'loading';
@@ -59,6 +66,7 @@
},
};
+ const action = changeThreadSettingsActionTypes.started;
dispatchActionPromise(
changeThreadSettingsActionTypes,
(async () => {
@@ -69,7 +77,7 @@
throw e;
}
})(),
- { customKeyName: `${changeThreadSettingsActionTypes.started}:avatar` },
+ { customKeyName: `${action}:${threadID}:avatar` },
);
},
[changeThreadSettingsCall, dispatchActionPromise],

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 29, 7:56 AM (9 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2731248
Default Alt Text
D7679.diff (2 KB)

Event Timeline