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: useChannelContext's channel.state.pinnedMessages property is not up to date #2054

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

vanGalilea
Copy link
Contributor

@vanGalilea vanGalilea commented Apr 14, 2023

🎯 Goal

useChannelContext's channel.state.pinnedMessages property must be up to date at all times.

when app state changes the pinnedMessages state must always stay up to date

🛠 Implementation details

addPinnedMessages was not called after clearing a channel when resyncing.

🎨 UI Changes

N/A

🧪 Testing

Add a sticky pinned messages list to your channel screen and monitor whether the list is up to date when pinning and unpinning messages.

Also, go to the background and return to the app. The pinnedMessages state must stay up to date.

const StickyPinnedMessagesList = () => {
  const { channel } = useChannelContext();

  return (
    <View style={{ padding: 32, backgroundColor: 'pink' }}>
      {channel?.state.pinnedMessages.map((message, i) => (
        <Text key={message.id}>
          {i + 1}. {message.text}
        </Text>
      ))}
    </View>
  );
};

Other related issues:

A BE issue has been spotted by @vishalnarkhede: pinned_message_ids not being in-sync on the channels table

@vanGalilea
Copy link
Contributor Author

vanGalilea commented Apr 14, 2023

Current issues we face at the moment due to BE.

  • pinning hello and hey succeeds.
  • when pinning Dhhh it updates only on one device (where reacted)
  • then pinning Vdddh doesn't update for no device 😐
  • when going to background on one device, the pinned messages update by the other device 🤯
  • when returning to active on one device, the last pinned message is not there 🤷:skin-tone-3:
  • since that moment pinning messages state was not up to date anymore

@vanGalilea vanGalilea marked this pull request as draft April 14, 2023 07:19
@sonarcloud
Copy link

sonarcloud bot commented Apr 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@vanGalilea vanGalilea marked this pull request as ready for review April 18, 2023 11:12
@vanGalilea vanGalilea merged commit 1af97ba into develop Apr 18, 2023
@vanGalilea vanGalilea deleted the fix/floating-pinning-ntwrk branch April 18, 2023 12:29
@github-actions github-actions bot mentioned this pull request Apr 28, 2023
6 tasks
@stream-ci-bot
Copy link
Contributor

🎉 This PR is included in version 5.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants