Skip to content

Commit

Permalink
janky refresh workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Dec 19, 2023
1 parent 3c57c6e commit 63ccc06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ <h5 class="mt-3">Troubleshooting</h5>
</b-card-body>
</b-card>

<b-table v-if="settings.tabIndex == 0 && !settings.showInfo" ref="approvalsTable" small fixed striped responsive hover selectable select-mode="single" @row-selected='approvalsRowSelected' :fields="approvalsFields" :items="pagedFilteredSortedApprovals" show-empty empty-html="Click Check above to retrieve ERC-20, ERC-721 and ERC-1155 Approval and ApprovalForAll events. Then please refresh this page" head-variant="light" class="mx-0 my-1">
<b-table v-if="settings.tabIndex == 0 && !settings.showInfo" ref="approvalsTable" small fixed striped responsive hover selectable select-mode="single" @row-selected='approvalsRowSelected' :fields="approvalsFields" :items="pagedFilteredSortedApprovals" show-empty empty-html="Click Check above to retrieve ERC-20, ERC-721 and ERC-1155 Approval and ApprovalForAll events" head-variant="light" class="mx-0 my-1">
<template #cell(number)="data">
<font size="-1">
{{ parseInt(data.index) + ((settings.approvalsTable.currentPage - 1) * settings.approvalsTable.pageSize) + 1 }}
Expand Down Expand Up @@ -329,7 +329,7 @@ <h5 class="mt-3">Troubleshooting</h5>
</template>
</b-table>

<b-table v-if="settings.tabIndex == 1 && !settings.showInfo && events" small fixed striped responsive hover :fields="eventsFields" :items="pagedFilteredSortedEvents" show-empty empty-html="Click Check above to retrieve ERC-20, ERC-721 and ERC-1155 Approval and ApprovalForAll events. Then please refresh this page" head-variant="light" class="mx-0 my-1">
<b-table v-if="settings.tabIndex == 1 && !settings.showInfo && events" small fixed striped responsive hover :fields="eventsFields" :items="pagedFilteredSortedEvents" show-empty empty-html="Click Check above to retrieve ERC-20, ERC-721 and ERC-1155 Approval and ApprovalForAll events" head-variant="light" class="mx-0 my-1">
<template #cell(number)="data">
<font size="-1">
{{ parseInt(data.index) + ((settings.eventsTable.currentPage - 1) * settings.eventsTable.pageSize) + 1 }}
Expand Down Expand Up @@ -447,6 +447,7 @@ <h5 class="mt-3">Troubleshooting</h5>
coinbase: null,
blockNumber: null,
timestamp: null,
forceRefresh: 0,

settings: {
tabIndex: 0,
Expand Down Expand Up @@ -538,7 +539,8 @@ <h5 class="mt-3">Troubleshooting</h5>
// --- COMPUTED ---
computed: {
approvals() {
const results = [];
// TODO: Fix janky workaround
let results = this.forceRefresh % 2 == 0 ? [] : [];
for (const [address, accountData] of Object.entries(this.accounts)) {
const [contract, type, symbol, name, source, owner] = [address, accountData.type, accountData.symbol, accountData.name, accountData.source, this.coinbase];
const approvals = 'approvals' in accountData && this.coinbase in accountData.approvals && accountData.approvals[this.coinbase] || null;
Expand Down Expand Up @@ -832,6 +834,7 @@ <h5 class="mt-3">Troubleshooting</h5>

async syncBlockTimestamps() {
console.log(moment().format("HH:mm:ss") + " syncBlockTimestamps BEGIN");
console.log(moment().format("HH:mm:ss") + " blockTimestamps: " + JSON.stringify(this.blockTimestamps));
const blockNumbersMap = {};
for (const event of this.events) {
if (!(event.blockNumber in blockNumbersMap)) {
Expand Down Expand Up @@ -1083,6 +1086,7 @@ <h5 class="mt-3">Troubleshooting</h5>
localStorage.approvalAccounts = JSON.stringify(accounts);
Vue.set(this, 'accounts', accounts);
// TODO: UI not updating
this.forceRefresh++;
console.log(moment().format("HH:mm:ss") + " processData END");
},

Expand Down

0 comments on commit 63ccc06

Please sign in to comment.