-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: A newly connected database doesn't appear in the databases list if user connected database using the 'plus' button #19967
fix: A newly connected database doesn't appear in the databases list if user connected database using the 'plus' button #19967
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19967 +/- ##
==========================================
- Coverage 66.65% 66.65% -0.01%
==========================================
Files 1729 1729
Lines 64910 64917 +7
Branches 6842 6843 +1
==========================================
+ Hits 43268 43272 +4
- Misses 19893 19895 +2
- Partials 1749 1750 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@stephenLYZ Ephemeral environment spinning up at http://34.220.151.120:8080. Credentials are |
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.
Thanks for the fix! Left a comment.
@@ -503,7 +503,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({ | |||
setImportingModal(false); | |||
setPasswords({}); | |||
setConfirmedOverwrite(false); | |||
if (onDatabaseAdd) onDatabaseAdd(); |
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'm curious about the reason for the deletion here, it looks like the close
method will be called in multiple places, not just the model closing.
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.
Yeah, sure.
Calling onDatabaseAdd
in the onClose
causes the callback to be fired when it shouldn't.
The onClose
is called, for instance, if you hit in the overlay.
That causes (in master) the following:
Screen.Recording.2022-06-03.at.13.26.19.mov
The only places that should be called is when a change was actually made (which was done already in almost all places, causing a double fetch/rerender).
The only place that uses this function is DatabaseList
, which only does a refresh.
b8acb2c
to
8fac930
Compare
Ephemeral environment shutdown and build artifacts deleted. |
…if user connected database using the 'plus' button
8fac930
to
7fe0307
Compare
@@ -94,6 +96,10 @@ const RightMenu = ({ | |||
state => state.dashboardInfo?.id, | |||
); | |||
|
|||
const [, setQuery] = useQueryParams({ |
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.
oh this is interesting, I hadn't seen this before. Does this bypass the variable and only create the function?
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, this just ignores the value in the first position, but the function returns the whole thing.
Just a nice syntax sugar thing when destructuring
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.
yeah I like it too!
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.
Thanks for the fix! LGTM
SUMMARY
The database connection modal fires a callback when a db is successfully connected.
The problem is, the database list cannot listen to that callback when the modal is displayed/shown outside of the container.
This PR enables that functionality via query params, so that the database list can be notified and refreshed.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
Screen.Recording.2022-05-05.at.22.19.44.mov
After:
new.mov
TESTING INSTRUCTIONS
Go to the dashboard list and connect a new database from the top "plus button" menu.
Ensure you can see the newly connected database without refreshing the page.
ADDITIONAL INFORMATION