Giter Site home page Giter Site logo

Comments (4)

codetomatot avatar codetomatot commented on May 5, 2024

I think that's just how it is made. I have the same thing. I dont think there is a solution

from instagramclone.

SimCoderYoutube avatar SimCoderYoutube commented on May 5, 2024

Hi!

Right now the auto reload is not implemented in the project, however it is not hard to do. Just rerun the fetch function and it should update both for the comments and profile.

from instagramclone.

Elie-Bsaibes avatar Elie-Bsaibes commented on May 5, 2024

Hi!

Right now the auto reload is not implemented in the project, however it is not hard to do. Just rerun the fetch function and it should update both for the comments and profile.

Thank you Simcoder for answering! But the fetch is happening in the useEffect(), isn't it supposed to re-fetch automatically when the component is updated?

from instagramclone.

EthanToews avatar EthanToews commented on May 5, 2024

My second issue is that when I upload a picture It doesn't appear automatically on the profile, I should refresh the app or log out and re-login to see it. Can anyone help me with these issues, please? Thanks in advance!

I managed to fix this by connecting redux in the save.js then binding the fetchUserPosts() to the mapDispatchProps and calling the fetchUserPosts()

import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { fetchUserPosts } from '../../redux/actions';

function Save(props){
...
}

const mapDispatchProps = (dispatch) => bindActionCreators({ fetchUserPosts }, dispatch);
export default connect(null, mapDispatchProps)(Save);

Then before you props.navigation.popToTop() you add props.fetchUserPosts()
to ensure the state is updated. After we post you must also add the props.posts to your useEffect in the profile page. to
ensure it updates when the posts state changes

useEffect(() => { .... }, [props.posts] )

This fixed that issue for me, I hope it can help others when they are coming across this issue.

from instagramclone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.