Browse Source

make the home screen elements load more quickly

pull/114/head
Trent Larson 5 months ago
parent
commit
606f21faec
  1. 26
      src/views/HomeView.vue

26
src/views/HomeView.vue

@ -268,7 +268,6 @@
</template>
<script lang="ts">
import * as R from "ramda";
import { UAParser } from "ua-parser-js";
import { IIdentifier } from "@veramo/core";
import { Component, Vue } from "vue-facing-decorator";
@ -306,8 +305,8 @@ interface GiveRecordWithContactInfo extends GiveSummaryRecord {
displayName: string;
known: boolean;
};
image: string;
recipientProjectName: string | undefined;
image?: string;
recipientProjectName?: string;
receiver: {
displayName: string;
known: boolean;
@ -488,8 +487,7 @@ export default class HomeView extends Vue {
endOfResults = false;
// include the descriptions of the giver and receiver
const identity = await this.getIdentity(this.activeDid);
const newFeedData: Array<Promise<GiveRecordWithContactInfo>> =
results.data.map(async (record: GiveSummaryRecord) => {
for (const record: GiveSummaryRecord of results.data) {
// similar code is in endorser-mobile utility.ts
// claim.claim happen for some claims wrapped in a Verifiable Credential
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -509,10 +507,7 @@ export default class HomeView extends Vue {
// check if the record should be filtered out
let anyMatch = false;
if (
this.isFeedFilteredByVisible &&
containsNonHiddenDid(record)
) {
if (this.isFeedFilteredByVisible && containsNonHiddenDid(record)) {
// has a visible DID so it's a keeper
anyMatch = true;
}
@ -527,10 +522,10 @@ export default class HomeView extends Vue {
}
}
if (this.isAnyFeedFilterOn && !anyMatch) {
return null;
continue;
}
return {
const newRecord: GiveRecordWithContactInfo = {
...record,
giver: didInfoForContact(
giverDid,
@ -539,7 +534,7 @@ export default class HomeView extends Vue {
this.allMyDids,
),
image: claim.image,
recipientProjectName: plan?.name,
recipientProjectName: plan?.name as string,
receiver: didInfoForContact(
recipientDid,
this.activeDid,
@ -547,11 +542,8 @@ export default class HomeView extends Vue {
this.allMyDids,
),
};
});
const allNewFeedData: GiveRecordWithContactInfo[] =
await Promise.all(newFeedData);
const filteredFeedData = allNewFeedData.filter(R.isNotNil);
this.feedData = this.feedData.concat(filteredFeedData);
this.feedData.push(newRecord);
}
this.feedPreviousOldestId =
results.data[results.data.length - 1].jwtId;
// The following update is only done on the first load.

Loading…
Cancel
Save