ProjectLibertyLabs / social-app-template

Social Application Template that uses Gateway Services
Apache License 2.0
1 stars 4 forks source link

fix: Do not cache empty blocks in fetchAndCachePosts #69

Closed mattheworris closed 5 months ago

mattheworris commented 5 months ago

Purpose

The goal of this PR is to fix posts not showing correctly.

Solution

fetchAndCachePosts was getting out of sync.

In the case where fetchAndCachePosts is called for a block, but it executes before the content-watcher sends the webhook notification, it would cache an empty block.

Then the announcement comes from content-watcher, the cache skips the block because it thinks it is already in the cache.

fetchAndCachePosts was modified so that empty blocks are not cached.

Developed with help from: @JoeCap08055 @saraswatpuneet

Change summary

Steps to Verify

  1. Startup SAT Backend and Frontend
  2. Create a new post and wait about 30-60 seconds (for content-watcher interval)
  3. Refresh the frontend and verify that My Posts shows the post that was just created.