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

fix: pinned chats are toggled as selected when editing folder #322

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

evgenii-minkov
Copy link

there is currently a bug

  1. create a folder
  2. add some chats
  3. pin some of added chats inside that folder
  4. open edit folder screen -> included chats
    Expected: Pinned chats are marked as selected as well as unpinned
    Current: Pinned chats are marked as unselected and can be "added" to the folder

proposed changes in this PR address that by modifying 'selectChatFilters' selector and 'editChatFolders' action handler

side-note: i understand that pinned chat ids are not stored as a subset of included chat ids during initial API fetches for the purposes of ordering during render

@korenskoy
Copy link
Contributor

Unfortunately, there is a bug in the implementation.
Try opening the folder edit screen -> Included Chats -> click Add Chats and try removing the locked chats from the list above the search bar.

2023-12-12.21.25.27.mov

@evgenii-minkov
Copy link
Author

@korenskoy thank you for pointing this out. i followed your guide and reproduced the behavior

i did a quick research and discovered the root of the issue:

  1. when removing chats by clicking above the search bar a new list of selected ids is constructed either by splicing or appending the old one
  2. this new array of selected ids is directed into the folder reducer, where all concatted ids are assigned to the "includedChatIds" field, which is not correct because they also contain "pinnedChatIds" (which remain the same)

what i did is:

  • when updating included chats i "deconstruct" new passed selected ids into 2 separate arrays: new included ids and new pinned ids

this fixes the behavior you showed in the video, but i do not particularly like what i'm doing here - this solution is an attempt to keep up with the separation of folder chats into included and pinned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants