-
Notifications
You must be signed in to change notification settings - Fork 17
fix(PM-1322): Redirect to requests page once copilot request is created #1129
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
base: dev
Are you sure you want to change the base?
Conversation
@@ -7,6 +7,7 @@ import { profileContext, ProfileContextData } from '~/libs/core' | |||
import { Button, IconSolid, InputDatePicker, InputMultiselectOption, | |||
InputRadio, InputSelect, InputSelectReact, InputText, InputTextarea } from '~/libs/ui' | |||
import { InputSkillSelector } from '~/libs/shared' | |||
import { EnvironmentConfig } from '~/config' |
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.
The import statement for EnvironmentConfig
is added, but it is not used in the current code diff. Ensure that it is necessary for the changes made in this pull request or remove it if it is not needed.
@@ -217,6 +218,7 @@ const CopilotRequestForm: FC<{}> = () => { | |||
setIsFormChanged(false) | |||
setFormErrors({}) | |||
setPaymentType('') | |||
window.location.href = `https://copilots.${EnvironmentConfig.TC_DOMAIN}/requests` |
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.
Using window.location.href
for navigation can cause a full page reload, which is not ideal for single-page applications. Consider using a method from your routing library (e.g., history.push
if using React Router) to navigate to the requests page without reloading the entire application.
@@ -217,6 +218,10 @@ const CopilotRequestForm: FC<{}> = () => { | |||
setIsFormChanged(false) | |||
setFormErrors({}) | |||
setPaymentType('') | |||
// Added a small timeout for the toast to be visible properly to the users | |||
setTimeout(() => { |
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.
Consider defining the timeout duration as a constant or configuration variable to improve code readability and maintainability. This would make it easier to adjust the timeout duration in the future if needed.
@@ -217,6 +218,10 @@ const CopilotRequestForm: FC<{}> = () => { | |||
setIsFormChanged(false) | |||
setFormErrors({}) | |||
setPaymentType('') | |||
// Added a small timeout for the toast to be visible properly to the users | |||
setTimeout(() => { | |||
window.location.href = `https://copilots.${EnvironmentConfig.TC_DOMAIN}/requests` |
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.
Can we use the router instead of doing full app reload?
Related JIRA Ticket:
https://topcoder.atlassian.net/browse/PM-1322
What's in this PR?