Add debounce for generating swap routes#621
Conversation
|
@kkpagaev is attempting to deploy a commit to the PaltaLabs OU Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull Request Overview
This pull request adds a debounce mechanism for generating swap routes to minimize the frequency of API requests when the swap form inputs change. Key changes include:
- Importing and using lodash-es's debounce function.
- Wrapping the generateRoute function with debounce via useCallback.
- Adjusting the formatting of assetIn/assetOut properties for clarity.
| }; | ||
|
|
||
| return { generateRoute, resetRouterSdkCache, maxHops }; | ||
| const generateRouteDebounce = useCallback(debounce(generateRoute, 500), [ |
There was a problem hiding this comment.
Consider including 'generateRoute' in the dependency array of useCallback to ensure that changes to its implementation are captured.
|
@MattPoblete Hi, we have been emailing Esteban on upwork for a few days now and haven't heard back from him. It would be great if he would reply. I'm duplicating the last text here: I just wanted to clarify something, as there might be a small misunderstanding. We’ve resolved the “Too Many Simultaneous Requests” issue as outlined in the assessment document. Initially you wanted to see how we work, to evaluate our approach, on the solution of the first task, I would like to get your feedback on this. We’re ready to move forward and assist further, just let us know if everything is on track and what the next steps are. Looking forward to your feedback! |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
In this PR, we addressed the issue where:
The issues you’ve described in conversation in this PR do not directly relate to our test task:
Additionally, based on your screenshots, we only see the results of the initial page load - not the behavior when interacting with the input field. We've prepared two short videos demonstrating the behavior before and after our changes. Screencast.From.2025-05-01.13-19-04.mp4This shows the behavior before any changes were applied. As you can see, entering three zeroes triggers three separate requests to the /split endpoint. new.mp4This shows the behavior after the changes were implemented. Performing the same action now results in only a single request to the /split endpoint. Please review our PR again and confirm that the reported issue has indeed been resolved. Looking forward to your feedback - thank you! |








Fix too many request when using inputs in swap form