message: cache whether preferencesFile and profileDocument have already been fetched
diff: @@ -48,7 +48,25 @@ export class SolidLogic {
  .load(profileDocument, { withCredentials: false, cache: 'reload' })
  }
  + async loadProfile (me: NamedNode): Promise<NamedNode> {
  + if (this.cache.preferencesFile[me]) {
  + return this.cache.preferencesFile[me]
  + }
  + let profileDocument
  + try {
  + profileDocument = me.doc()
  + await this.loadDoc(profileDocument)
  + return profileDocument
  + } catch (err) {
  + const message = `Logged in but cannot load profile ${profileDocument} : ${err}`
  + throw new Error(message)
  + }
  + }
  +
  async loadPreferences (me: NamedNode): Promise<NamedNode> {
  + if (this.cache.preferencesFile[me]) {
  + return this.cache.preferencesFile[me]
  + }
  const preferencesFile = this.store.any(me, ns.space('preferencesFile'))
  /**
  @@ -115,21 +133,6 @@ export class SolidLogic {
  return this.store.fetcher.load(doc)
  }
  - async loadProfile (webID?: NamedNode): Promise<NamedNode> {
  - if (!webID) {
  - throw new Error('Could not log in')
  - }
  - let profileDocument
  - try {
  - profileDocument = webID.doc()
  - await this.loadDoc(profileDocument)
  - return profileDocument
  - } catch (err) {
  - const message = `Logged in but cannot load profile ${profileDocument} : ${err}`
  - throw new Error(message)
  - }
  - }
  -
  async loadIndexes (
  me: NamedNode | string,
  publicProfile: NamedNode | string | null,
  