urbit / bridge

An application for interacting with Azimuth.
MIT License
95 stars 25 forks source link

accept-transfer: fix infinite render leading to roller request spam #1052

Closed pkova closed 1 year ago

pkova commented 1 year ago

I recently decided to accept some stars. It was not a great experience, hence this PR.

The root of the problem is that Bridge is polling the roller every second, which together with some bugs relating to reference equality results in a DDOS-esque number of requests to the roller after a the transaction to accept the point completes.

Fixes #709, #965

tomholford commented 1 year ago

@pkova Thank you so much for your contribution. Legendary!

Pulled the branch to try it out locally, but ran into this issue:

image

If this is more than a quick Typescript fix, I can take a look at this later this week.

edit: Tried a quick tweak to the updateParams type but now running into this:

image

Since I lack the appropriate context at this point, will defer to you for now. Otherwise will dig into this later in the week

another edit:

here's the git patch for the aforementioned tweak:

diff --git a/src/lib/useRoller.ts b/src/lib/useRoller.ts
index f5bed490..5cfc49b6 100644
--- a/src/lib/useRoller.ts
+++ b/src/lib/useRoller.ts
@@ -50,6 +50,7 @@ interface UpdateParams {
   field?: PointField;
   l1Txn?: PendingL1Txn;
   intervalTime?: number;
+  pointValue?: number;
 }

 export default function useRoller() {
pkova commented 1 year ago

Back in my day Bridge was Javascript!

Fixed the typescript errors, let me know if it works now.

pkova commented 1 year ago

I noticed that tsc still complains, but it's about files that are unchanged from my stuff.