GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
211 stars 62 forks source link

Opening "Add track" drawer produces duplicate keys error with internet accounts #3201

Closed cmdcolin closed 2 years ago

cmdcolin commented 2 years ago

On jbrowse desktop

Error:

"Warning: Encountered two children with the same key, `.2:$placeholderId`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version."

desktop default has google drive and dropbox integrations. removing those e.g. making const defaultInternetAccounts = [] as any[] makes the warning go away

It is unclear why they receive placeholderId because the defaultInternetAccounts have internetAccountId fields

const defaultInternetAccounts = [
  {
    type: 'DropboxOAuthInternetAccount',
    internetAccountId: 'dropboxOAuth',
    name: 'Dropbox',
    description: 'Account to access Dropbox files',
    clientId: 'ykjqg1kr23pl1i7',
  },
  {
    type: 'GoogleDriveOAuthInternetAccount',
    internetAccountId: 'googleOAuth',
    name: 'Google Drive',
    description: 'Account to access Google Drive files',
    clientId:
      '109518325434-m86s8a5og8ijc5m6n7n8dk7e9586bg9i.apps.googleusercontent.com',
  },
]
cmdcolin commented 2 years ago

can use acct.id instead of acct.internetAccountId (as it is a full model, not a config, but the model provides a getter for the config slot called get internetAccountId that runs getConf(self,'internetAccountId')

note that this issue is just something I stumbled on, not related to any report or anything but it is good to get the key's right