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 liking a publication re-renders entire feed #4188

Open
bigint opened this issue Dec 12, 2023 · 30 comments
Open

Fix liking a publication re-renders entire feed #4188

bigint opened this issue Dec 12, 2023 · 30 comments

Comments

@bigint
Copy link
Member

bigint commented Dec 12, 2023

Screen.Recording.2023-12-12.at.12.33.56.PM.mov
@RutamBhagat
Copy link

RutamBhagat commented Dec 12, 2023

would like to work on this issue /attempt #4188

Options

@Ameer-officials
Copy link

Ameer-officials commented Dec 12, 2023

/attempt #4188

Options

Copy link

algora-pbc bot commented Dec 12, 2023

Note

The user @RutamBhagat is already attempting to complete issue #4188 and claim the bounty. We recommend checking in on @RutamBhagat's progress, and potentially collaborating, before starting a new solution.

@RutamBhagat
Copy link

RutamBhagat commented Dec 12, 2023

Screenshot from 2023-12-12 13-59-23

@bigint Is there a way to test the liking without a lens profile?

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

@RutamBhagat Try with testnet, change your env to testnet then create an account (click login -> create new account)

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

@rajdip-b
Copy link

@bigint I tried this on my device but wasn't able to reproduce the bug.

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

@rajdip-b you not seeing rerenders? can you make a short video and share 🙇🏼 ?

@RutamBhagat
Copy link

the rerenders are visible for me

@rajdip-b
Copy link

That's odd. I'm using firefox. Perhaps you can tell me where I should focus on? I was looking at the DOM tree from the inspect tab.

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

You should use react chrome extension and enable rerender paints!

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

Screenshot 2023-12-12 at 3 23 27 PM

@rajdip-b
Copy link

Ahh, okay looks like I need to switch to chrome for dev 🥲.

@RutamBhagat
Copy link

@rajdip-b search react dev tools addon

@RutamBhagat
Copy link

@rajdip-b you can work on this, I am cancelling my attempt

@rajdip-b
Copy link

@RutamBhagat sure! can you give me some insights about anything that you might have came across that is making this issue?

@rajdip-b
Copy link

@bigint is this bug localized to the "Home" section alone? or is it happening in explore aswell?

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

it happens on all feed @rajdip-b 🙇🏼

@rajdip-b
Copy link

hmmmm....lemme get to it then

@rajdip-b
Copy link

@bigint can you assign me this one please?

@rajdip-b
Copy link

rajdip-b commented Dec 12, 2023

@bigint hey, i seem to have fixed the issue.
image
it involves removing the updateCache function from apps/web/src/components/Publication/Actions/Like.tsx. but i am unsure about the side effects of this. rest assured, the app looks and performs like it is supposed to. care to give it a look?

alternatively, my understanding is, the application is listening to cache updates. and so, updating the cache makes the entire thing re-render.

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

@rajdip-b the cache is intended to update values across components

Here is the example, both are different comp but we update it 😉

Screen.Recording.2023-12-12.at.7.02.57.PM.mov

@rajdip-b
Copy link

checked this component aswell, the entire component is re-rendering. is this expected?

@rajdip-b the cache is intended to update values across components

Here is the example, both are different comp but we update it 😉
Screen.Recording.2023-12-12.at.7.02.57.PM.mov

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

It is expected to rerender only the count but not the complete publication 🙇🏼

@rajdip-b
Copy link

got it

@rajdip-b
Copy link

rajdip-b commented Dec 12, 2023

Hey @bigint, I don't know if I am seeing this correct, but I really feel that there is no re-rendering going on. I added a console log to the publication component that will execute every single time the component was rendered. And as I expected, only those components were re-rendered where I was liking/unliking.
image

Check the logs section, might give you the idea about what I am saying.
Screencast from 12-12-23 07:32:15 PM IST.webm

Another point being, re-renders occur when we have duplicate/no keys of list items. But that's not the case in here:
image

@bigint
Copy link
Member Author

bigint commented Dec 12, 2023

Interesing, lemme try it

@Praveen-das
Copy link

Just checking the issue and come to the same conclusion . Even if the Feed component get rerendered, only the publication component needs rerendering got rerendered.

1

2

@GauravBurande
Copy link

GauravBurande commented Jan 31, 2024

/attempt #4188

@GauravBurande
Copy link

It looks like no one is working on this issue. can I work on this?

@heyxyz heyxyz deleted a comment from algora-pbc bot Feb 7, 2024
@algora-pbc algora-pbc bot removed the 💎 Bounty label Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

6 participants