-
Notifications
You must be signed in to change notification settings - Fork 180
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
Get Processing Status from Redis into the frontend #10297
base: main
Are you sure you want to change the base?
Conversation
@thewca-bot deploy staging |
@thewca-bot deploy staging |
@kr-matthews any idea why this causes an infinite loop? I thought doing it like this
will make sure the value will not override it again. |
@@ -79,6 +80,10 @@ export default function CompetingStep({ | |||
|
|||
const [processing, setProcessing] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What goes against just using the isProcessing
that is passed in from the backend as initial value for this state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user refreshes while processing, then processing finishes, react rerenders and it will set it to true again, which will cause it to be stuck in a process -> finish -> process loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to fix that with the useEffect, but it still occurs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the loop is being caused by the useEffect
. My point was to remove the useEffect
and instead use the initialization value here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not. I had it exactly like you proposed previously and it caused the same loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fc0048e
see first commit
I don't see an "easy" solution here. The problem is that the "backend" version of The technical problem is that within the body of I can see two solutions, with neither of them being overly amazing:
The ideal solution (which requires significant effort though) would of course be to move everything into a shared |
I wouldn't mind also getting the registration into the page and conditionally checking for if processing only if no registration exists, but I would need to touch the v1
@registration = @competition.registrations.find_or_initialize_by(user_id: current_user.id, competition_id: @competition.id)
line which sounds dangerous for the little time we have to get this out