Browse Source

make the home screen elements load more quickly

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

26
src/views/HomeView.vue

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

Loading…
Cancel
Save