Git Product home page Git Product logo

Comments (4)

taion avatar taion commented on August 16, 2024

You probably have a container (maybe Redux) that has shouldComponentUpdate and is blocking re-rendering.

from react-router-relay.

nuclearspike avatar nuclearspike commented on August 16, 2024

Thanks for the speedy response! Of the two components, the UserProfile (the one that works) is the only one that has a redux container.

One other thing that is different between the two, is that the Contracts are listed as search results on a page where I'm clicking from. I don't yet quite know how Relay's cache works or how smart it is about what it tries to refresh to fill in the missing details. But, even still, the search results have properties that should be in that cache, I would think.

I have the ContractDetail output the contract prop on render and when I click into it from the listing, I only get this, where it is an object, it just is missing all the data:
{dataID: "Q29udHJhY3QtMw=="}

When I do a page refresh, it outputs:

{__dataID__: "Q29udHJhY3QtMw=="
description:null
id:"Q29udHJhY3QtMw=="
title:"Contract Title"
website:null}

So, I too was wondering if it was a shouldComponentUpdate issue since it seems like it's confused about the fact that the contract prop existed but was unpopulated.

But, one would think if it were merely a case of it not re-rendering but where the data is actually in the Relay cache, then clicking on something else and coming back to the page, it should be able to populate from the cache... but it doesn't.

from react-router-relay.

nuclearspike avatar nuclearspike commented on August 16, 2024

I made some changes to the Graph definitions in Ruby, did some schema refreshes and it is now working... I'm not entirely sure what I did to fix it but the issue is gone. This can be closed.

from react-router-relay.

vadimshvetsov avatar vadimshvetsov commented on August 16, 2024

I have the same issue and I'm not sure that it needs own page, still seeking for the solution. When I switching between sibling pages (both have path /tag/:id) child Posts component doesn't rerendered. But when I click Link from main page with path / it render correctly. How to get rerendered Posts component inside Tag component when I'm on another Tag component with pressing Link to another /tag/:id?

EDIT:

I've founded the mistake in my code, sry for question, but anyway I will share it, may be it will help somebody.

So in my child React component I had constructor property with this code:

this posts = this.props.tag && this.props.tag.posts.edges.length > 0
      ? this.props.tag.posts.edges
      : this.props.viewer.posts.edges || []

I was removed constructor property and add this to render method:

const posts = this.props.tag && this.props.tag.posts.edges.length > 0
      ? this.props.tag.posts.edges
      : this.props.viewer.posts.edges || []

My Posts component has two fragments tag or viewer, because this component can be used as a IndexRoute and as a TagPage child container for viewing tag related posts.

from react-router-relay.

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.