-
Notifications
You must be signed in to change notification settings - Fork 13
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
Poll for pending records in UI until active or error #355
Conversation
app/routes/__index/domains/index.tsx
Outdated
revalidator.revalidate(); | ||
}, | ||
pending ? 5_000 : null | ||
); | ||
|
||
return ( | ||
<Container maxW="contianer.xl"> |
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.
Not related to this PR, but we should file an issue to fix the spelling error in the value for maxW
, so CSS rules can be applied as intended.
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.
Nice. I'll fix it here, since I'm in this file.
In this PR, will the newly created record ever change to 'active'? |
It should. When that happens depends on how long it takes for the DNS to finish. |
|
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.
LGTM!
app/routes/__index/domains/index.tsx
Outdated
const domains = useTypedLoaderData<typeof loader>(); | ||
const pending = domains.some((domain) => domain.status === 'pending'); |
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.
Would be useMemo
here applicable to avoid unnecessary UI re-renders?
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 don't think we need useMemo
here, since we always want to be in sync with the value of `domains, and the cost of the calculation is cheap.
But I'll add and we can remove if it i's not working.
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.
LGTM
I had to rebase to update |
Fixes #316.
This change removes the manual update logic for a user's DNS Records, replacing it with automated polling based on the
status
of the records.When we display the table, we check to see if any of the records are
status === 'pending'
(i.e., vs.active
orerror
). If any arepending
, we start an interval that runs every 5s, and recalls the loader to check for updates. Once thepending
status is gone, we stop the interval.To test this:
name=issue316
,type=A
,value=192.168.2.1
)I also cleaned up the ordering of the imports.