mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 01:25:36 -05:00
Fix undefined error in server tree data source (#12616)
* Fix undefined error in server tree data source * Add comment
This commit is contained in:
@@ -29,8 +29,13 @@ export class ServerTreeDataSource implements IDataSource {
|
||||
* Returns the unique identifier of the given element.
|
||||
* No more than one element may use a given identifier.
|
||||
*/
|
||||
public getId(tree: ITree, element: any): string {
|
||||
return element.id;
|
||||
public getId(tree: ITree, element?: any): string {
|
||||
// Note there really shouldn't be any undefined elements in the tree, but the original implementation
|
||||
// didn't do that correctly and since this is going to replaced by the async tree at some point just
|
||||
// making it so we handle the undefined case here.
|
||||
// This should be safe to do since the undefined element is only used when we want to clear the tree
|
||||
// so it'll be the only "element" in the tree and thus there shouldn't be any duplicate ids
|
||||
return element?.id || '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user