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
UI freezes when chrome devtools is open #2378
Comments
Hi! I'd be happy to work through this problem with you.
This is my first hunch of a potential problem. What extensions do you have installed (e.g.
Adding
I would also investigate this action. Are you certain that no other sagas are being triggered here? It seems you already know that this is causing a lot of rendering, this might be a good place to try to figure out how to optimize performance. Finally, I would try to monitor performance while this task is running. The "Performance" tab in the Chrome devtools is a great resource for this. It should help you pinpoint what is causing the UI thread to lock. Hopefully that gives you enough to continue your investigation, good luck, and feel free to keep chatting here! |
Thank you for your time !
I did what you suggested regarding the plugins, the culprit is not a single plugin but an accumulation. The biggest culprit is LastPass for some reason.
This goes hand in hand with my current understanding aswell. I think there could be some nuance here which will make me understand the behaviour I'm seeing. <button
onClick={() => {
console.log("1");
onClose(); // when state updates: console.log("2");
console.log("3");
startSaveSelectedDates(dates);
console.log("4");
}
/>
function* startSelectDatesSaga(
action: ActionType<typeof flexHoursActions.startSelectDates>,
) {
console.log("saga 1");
const { selectedDates } = action.payload;
yield put(flexHoursActions.setSelectedDates(selectedDates));
console.log("saga 2");
const {
employeeHours,
}: SagaReturnType<typeof actualAPI.getEmployeeHours> = yield call(
actualAPI.getEmployeeHours,
{
dates: selectedDates,
},
);
console.log("saga 3");
yield put(employeeHourActions.setEmployeeHours(getEmployeeHours));
console.log("saga 4");
} The console says: In my mind I would expect And even with the I guess why I'm not seeing So basically is what I wrote above how it works? If yes, the plugins slows down the rendering so much so that I experience the issue. Thank you again, sorry if it ended up a bit confusing. |
In your import { takeEvery } from 'redux-saga/effects';
function* watchSelectedDates() {
yield takeEvery("START_SELECTED_DATES", startSaveSelectedDates);
}
// then in react component
function App() {
const dispatch = yield* useDispatch();
const onClick = () => {
dispatch({ type: "START_SELECTED_DATES", payload: dates });
}
} |
Hello again ! the I'm positive that I do everything correctly regarding how actions are dispatched. I bleieve this is just a understanding issue from my part. |
Hi!
User since several years and currently facing an issue which baffels me.
I'm not entirely sure that the behaviour is due to
redux-saga
, but I'm hoping you could provide me some context which will make me understand what is going on.Scenario
A modal is open with the possibility to select dates which will be used to fetch data through a
saga
.When pressing "save" in that modal the following flow is defined:
The
onClose();
affects the state as it should but the render for the state update is not happening until the saga resolves.Here are some details regarding the circumnstances of the issue:
yield delay(1)
in the beginnig of the saga, the issue dissapears.Saga code
So the culprit seems to be the
yield put(flexHoursActions.setSelectedDates(selectedDates));
and the renders it causes. But I don't understand why there is an issue.I'm hoping you can enlighten me!
Also, thank you for your work!
/ Jakob
Description
Please provide some context about the problem and some code examples if relevant.
The best way to provide an example is repository or use Code Sandbox(there is a prepared template for Code Sandbox)
The text was updated successfully, but these errors were encountered: