Prevent duplicate requests during generation
A visual disabled style should agree with request logic. Rapid input or keyboard submission can bypass an appearance-only treatment.
Start here
This example uses the sample details below. Replace them with your own facts before applying the instructions.
- Generate button can be pressed repeatedly while a request runs.
Start with the facts
Generate button can be pressed repeatedly while a request runs. Keep a small reproducible example and the expected behavior. Remove secrets from the code or error message before requesting help.
Spot the problem
The wording or action to avoid is: “Send a request for every click and charge every attempt.” A visual disabled style should agree with request logic. Rapid input or keyboard submission can bypass an appearance-only treatment.
Make the correction
Disable or guard submission while the current request is active and restore the control when the state ends.
Check before using the result
Use rapid clicks and keyboard submission in a test environment and check that one active action creates one request.
Worked example and reusable input
Use the stated inputs to reproduce checked local outputs. Replace sample facts when applying a brief to your own work.
TASK Prevent duplicate requests during generation SAMPLE INPUT — replace with your actual facts Generate button can be pressed repeatedly while a request runs. AVOID Send a request for every click and charge every attempt. CORRECTED APPROACH Disable or guard submission while the current request is active and restore the control when the state ends. ACCEPTANCE CHECK Use rapid clicks and keyboard submission in a test environment and check that one active action creates one request.
Key takeaways
- A visual disabled style should agree with request logic. Rapid input or keyboard submission can bypass an appearance-only treatment.
- Use rapid clicks and keyboard submission in a test environment and check that one active action creates one request.