Fix blink when change Site Drive Library

This commit is contained in:
aaclage 2021-04-18 12:09:48 +02:00
parent d8d0e3a5de
commit b5ad86cc32
1 changed files with 4 additions and 12 deletions

View File

@ -175,7 +175,7 @@ export default class OneDriveFinder extends React.Component<IOneDriveFinderProps
this._siteID = ""; this._siteID = "";
this.setState({ this.setState({
siteID: this._siteID, siteID: this._siteID,
itemID: selectedOption.key.toString(), itemID: "",
breadcrumbItem: this._breadcrumbItem breadcrumbItem: this._breadcrumbItem
}); });
} }
@ -268,6 +268,7 @@ export default class OneDriveFinder extends React.Component<IOneDriveFinderProps
let graphData: any = await this.getGraphContent("https://graph.microsoft.com/v1.0/sites/" + siteID + "/drive/root://:/?$select=id"); let graphData: any = await this.getGraphContent("https://graph.microsoft.com/v1.0/sites/" + siteID + "/drive/root://:/?$select=id");
return graphData.id; return graphData.id;
} }
private getOneDriveRootFolderID = async (key) => { private getOneDriveRootFolderID = async (key) => {
let graphData: any = await this.getGraphContent("https://graph.microsoft.com/v1.0/me/drive/items/" + key + "?$select=id"); let graphData: any = await this.getGraphContent("https://graph.microsoft.com/v1.0/me/drive/items/" + key + "?$select=id");
return graphData.id; return graphData.id;
@ -278,18 +279,10 @@ export default class OneDriveFinder extends React.Component<IOneDriveFinderProps
*/ */
private getDrives = async (selectedOption: IDropdownOption) => { private getDrives = async (selectedOption: IDropdownOption) => {
let itemID: any; let itemID: any;
let siteID: any;
if (selectedOption.data.root != undefined) { if (selectedOption.data.root != undefined) {
itemID = await this.getOneDriveRootFolderID(selectedOption.key); itemID = await this.getOneDriveRootFolderID(selectedOption.key)
this._itemID = itemID;
siteID = "";
this._siteID = "";
} else { } else {
itemID = await this.getRootDriveFolderID(selectedOption.key); itemID = await this.getRootDriveFolderID(selectedOption.key)
this._itemID = itemID;
siteID = selectedOption.key;
this._siteID = selectedOption.key.toString();
} }
this._breadcrumbItem = []; this._breadcrumbItem = [];
@ -316,7 +309,6 @@ export default class OneDriveFinder extends React.Component<IOneDriveFinderProps
}); });
this.setState( this.setState(
{ {
siteID: siteID,
breadcrumbItem: this._breadcrumbItem, breadcrumbItem: this._breadcrumbItem,
itemID: itemID itemID: itemID
}); });