-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ import React, { Fragment, useState, useEffect } from 'react'; | |
import rison from 'rison'; | ||
import { useSelector } from 'react-redux'; | ||
import { Link } from 'react-router-dom'; | ||
import { useQueryParams, BooleanParam } from 'use-query-params'; | ||
|
||
import { | ||
t, | ||
styled, | ||
|
@@ -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 commentThe 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 commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I like it too! |
||
databaseAdded: BooleanParam, | ||
}); | ||
|
||
const { roles } = user; | ||
const { | ||
CSV_EXTENSIONS, | ||
|
@@ -250,13 +256,16 @@ const RightMenu = ({ | |
return null; | ||
}; | ||
|
||
const handleDatabaseAdd = () => setQuery({ databaseAdded: true }); | ||
|
||
return ( | ||
<StyledDiv align={align}> | ||
{canDatabase && ( | ||
<DatabaseModal | ||
onHide={handleOnHideModal} | ||
show={showModal} | ||
dbEngine={engine} | ||
onDatabaseAdd={handleDatabaseAdd} | ||
/> | ||
)} | ||
<Menu | ||
|
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 theonClose
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.