feat: gen title by sperate api call

feat:

fix: rename of convo should based on real request.
This commit is contained in:
Wentao Lyu 2023-03-13 14:04:47 +08:00
parent 8773878be2
commit 9f8e9cb091
8 changed files with 65 additions and 28 deletions

View file

@ -11,7 +11,7 @@ import { incrementPage, setConvos } from '~/store/convoSlice';
export default function Nav({ navVisible, setNavVisible }) {
const dispatch = useDispatch();
const [isHovering, setIsHovering] = useState(false);
const { conversationId, convos, pageNumber } = useSelector((state) => state.convo);
const { conversationId, convos, pageNumber, refreshConvoHint } = useSelector((state) => state.convo);
const onSuccess = (data) => {
dispatch(setConvos(data));
};
@ -20,6 +20,7 @@ export default function Nav({ navVisible, setNavVisible }) {
`/api/convos?pageNumber=${pageNumber}`,
onSuccess
);
const containerRef = useRef(null);
const scrollPositionRef = useRef(null);
@ -35,7 +36,7 @@ export default function Nav({ navVisible, setNavVisible }) {
}
};
useDidMountEffect(() => mutate(), [conversationId]);
useDidMountEffect(() => mutate(), [conversationId, refreshConvoHint]);
useEffect(() => {
const container = containerRef.current;