Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Message Data structure to hashmap #232

Open
AlexanderWangY opened this issue Aug 30, 2024 · 3 comments
Open

Migrate Message Data structure to hashmap #232

AlexanderWangY opened this issue Aug 30, 2024 · 3 comments
Assignees
Labels
Frontend 🖥 Issues corresponding to the frontend/client. Hard You should be an active contributor to work on this issue Improvement Important changes made that are not described by an optimization or refactor

Comments

@AlexanderWangY
Copy link
Collaborator

As of now, all incoming messages are stored in an array. However this is inefficient and also hard to play around with (especially with replies and reactions). Therefore we need to migrate to a hashmap Map<Key, Value> where Key is the messageID and the value is the message.

Please also make it in chronological order please so the chat is normal :)

@AlexanderWangY AlexanderWangY added Frontend 🖥 Issues corresponding to the frontend/client. Hard You should be an active contributor to work on this issue Improvement Important changes made that are not described by an optimization or refactor labels Aug 30, 2024
@AlexanderWangY AlexanderWangY self-assigned this Sep 6, 2024
@KOrtizLedezma
Copy link
Contributor

Can I get this one assigned?

@h1divp
Copy link
Collaborator

h1divp commented Feb 8, 2025

Messages are stored inside of the FlatList inside of components/chat/MessageChannel.tsx
I think all we simply need to do is update this component so that it uses a message timestamp as the key (keyExtractor={msg => msg.time}), and otherwise takes in message data normally (data={messages}). I don't think we would need to reverse the messages array either.
Moreover when it comes to rerendering elements already in the FlatList, say from someone sending a reaction, there's a parameter called extraData that looks convient (https://reactnative.dev/docs/flatlist)

Unless if there is any objection, I would update the FlatList in this way and then mark this issue as completed

@connor-kress
Copy link
Contributor

I would like to have this issue assigned. I got this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend 🖥 Issues corresponding to the frontend/client. Hard You should be an active contributor to work on this issue Improvement Important changes made that are not described by an optimization or refactor
Projects
Status: Unassigned
Development

No branches or pull requests

4 participants