Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3571157
D7679.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7679.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D7679: [native] have saving thread avatar loaders only appear for thread being updated
Attached
Detach File
Event Timeline
Log In to Comment