-
Notifications
You must be signed in to change notification settings - Fork 30
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
React component does not re-render if state remains and a prop change #25
Comments
Would you be able to show a code example? |
Well, there is an action that gets an array of files and has to return the same array of files, but continuously update the array before it finishes:
The label should be seen on every file, but it only shows on the first item, and when the process finishes, the UI remains intact. The UI should reflect the current file being processed |
If this is still an issue, could you provide more context? Is |
First of all, apologies @thekarel for late reply. Answering your question, When the callback is called again, the same I know it's because I don't move to another state the second time the callback is called, but the data actually changed. So I'm wondering how to achieve this task. In order to provide more context, the use case I'm tacking here is to analyze a list of folders and provide the user feedback in which folder is being processed. |
If your change is buried in your props, and therefore doesn't show a difference between your
I don't suggest doing a direct comparison of nested properties that may or may not exist like this. It's better to have a helper function that returns
|
Hello.
I'm working on an electrón app that manage folders.
I want that, when the user drops some folders into the app, let's say five, a message shows indicating which folder is being processed.
The way I'm doing it is by not changing the state at all but just sending the same array of folders (these are just objects) with the difference that the current folder has a prop named
current
set to true, and it gets toggled to every folder being processed.So, the problem is that, only by passing to the machine a slightly different array, it doesn't re-render the component, and it only do that if I change the state and change it back.
Any hint in how to solve this?
The text was updated successfully, but these errors were encountered: