11 lines
285 B
JavaScript
11 lines
285 B
JavaScript
export const getAdjacentConversationId = (conversationIds, currentId) => {
|
|
const currentIndex = conversationIds.indexOf(currentId);
|
|
if (currentIndex === -1) return null;
|
|
|
|
return (
|
|
conversationIds[currentIndex + 1] ??
|
|
conversationIds[currentIndex - 1] ??
|
|
null
|
|
);
|
|
};
|