Need to refresh data

i have subscription on this.liveFeed.on(‘dataUpdated’, posts

i need to refresh data when another user add new post

i make this.liveFeed.dispose();
and call ( this.liveFeed.on ) aging but the data not changed
it changed only when refresh page

how to refresh this.liveFeed.on() to be initialize again

@mohamedismael This might happen because this.liveFeed.on(‘dataUpdated’, posts in the useEffect is called before the post has finished the post creation. You can follow my code.

const [postObject, setPostObject] = useState()

  const createPost =()  => {
    const livePost = PostRepository.createTextPost({
      targetId: 'userId',
      targetType: PostTargetType.UserFeed, // optional, max no.of tags = 5, max length per tag = 24 chars
      text: 'Test post text',
    livePost.once('dataUpdated', model => {
      console.log('Post', model);
const queryPost=()=>{
  const liveFeed = PostRepository.queryUserPosts({
    userId: 'userId',
    includeChildrenPosts: true,
    includeDeletedPosts: false,
    sortBy: PostSortingMethod.FirstCreated, // see PostSortingMethod


  liveFeed.once('dataUpdated', posts => {
    console.log('this is post query', => post))

  useEffect(() => {
  }, [postObject])

From the code, I made the useEffect call the queryPost function after the post creation is finished, so after you call function createPost(), it will also call queryPost() without refreshing the page.

sorry but this not what i want
i use vuejs
and i need to refresh data when another user create a post not the current user
i will show you the scenario

1- load - PostRepository.queryAllPosts
2- subscribe to it on(‘dataUpdated’)
3- another user with different device add new post
4- the current user not see the post until he refresh the whole page and call client.registerSession({ userId })

user can refresh data and see another user post without refresh page and call client.registerSession again

i used vuejs not react
can you explain to me how to get updated data from database whiteout make register session again

another scenario when user follow another user
he can`t see his posts after he register again

Basically, the updated data can be gotten by calling again the query function. Try to avoid refreshing web page because this will end the user session, so that’s why you need to call client.registerSession({ userId }) again. The main reason that you’re not received updated data because you haven’t call query post function again yet after someone create a new post.
Therefore, my recommendation would be
1- load - PostRepository.queryAllPosts
2- subscribe to it on(‘dataUpdated’)
3- another user with different device add new post
4. Create button to trigger query post function and call query post function again ( repeat step 1 and 2)

For example in facebook , users get the updated post data when they click at the home tab button. This is one of the ideas that you can use to receive updated posts without refreshing the web page.

Is the second scenario similar to issue 1? Can you help explain in detail so that I can help you investigate the scenario ?