-
Notifications
You must be signed in to change notification settings - Fork 68
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
fix: Site build polling and latest build branch #4663
base: main
Are you sure you want to change the base?
Conversation
🤖 This is an automated code coverage reportTotal coverage (lines): 14.04% |
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.
This is a big improvement and I'm excited about the new patterns. Added a few small questions/comments
import { useQuery } from '@tanstack/react-query'; | ||
import api from '@util/federalistApi'; | ||
|
||
// Assumes the order of builds is based on createdAt desc |
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 think there's a slight potential for race conditions because of createdAt sorting vs completedAt checking but I'm fine ignoring for now
frontend/support/data/builds.js
Outdated
@@ -0,0 +1,1349 @@ | |||
export const builds = [ |
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.
Eventually we should create some standardized way of creating our fixtures but this is perfect for now
import AlertBanner from '@shared/alertBanner'; | ||
import LoadingIndicator from '@shared/LoadingIndicator'; | ||
|
||
export default function QueryPage({ |
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.
Love this
/> | ||
</div> | ||
)} | ||
{data?.length > 0 && ( |
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.
Is there a way to avoid these checks in the QueryPage
children? It shouldn't try to render the child without data but not sure if component still gets fully run
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.
This could be cut because the QueryPage
does not render the child without data.
return request(`site/${site.id}/build`); | ||
return request( | ||
`site/${site.id}/build`, | ||
{}, |
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 are theses changes need to the API request?
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 request
method kicks off a notification redux action by default and these args skips the notification action. The QueryPage
wrapper we now handle the error from a react-query request with an alert.
d923955
to
88e23a9
Compare
Signed-off-by: Andrew Burnes <andrew.burnes@gsa.gov>
88e23a9
to
5f03ab4
Compare
}); | ||
} | ||
|
||
export function useBuilds(id) { |
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'd rename this variable siteId
for clarity (and it will bind the second variable of the mutation function which I think right now might not be needed)
|
||
it('should mutate the builds on rebuild', async () => { | ||
const siteId = 1; | ||
await getSiteBuilds(siteId, 'Something happened'); |
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.
No second argument
Closes #4650 and #4648
Changes proposed in this pull request:
security considerations
Adds new dependency react-query to manage http calls