Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Fix: debounce fetch apps #1021

Merged
merged 28 commits into from
Jul 30, 2020
Merged

Fix: debounce fetch apps #1021

merged 28 commits into from
Jul 30, 2020

Conversation

nicosampler
Copy link
Contributor

closes #999.

@nicosampler nicosampler self-assigned this Jun 16, 2020
@ghost
Copy link

ghost commented Jun 16, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

src/routes/safe/components/Apps/ManageApps.tsx Outdated Show resolved Hide resolved
@@ -22,7 +22,7 @@ export const staticAppsList: Array<{ url: string; disabled: boolean }> = [
{ url: `${gnosisAppsUrl}/synthetix`, disabled: false },
]

export const getAppInfoFromOrigin = (origin) => {
export const getAppInfoFromOrigin = (origin: string): Record<string, any> | null => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change any to unknown

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, but it was complaining about the "unknown" type, I'll try again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates of this ? @fernandomg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shame on me that assumed those were all old. I'll have a look

@mmv08
Copy link
Member

mmv08 commented Jul 7, 2020

@nicosampler what's up with this ticket?

@mmv08
Copy link
Member

mmv08 commented Jul 16, 2020

@nicosampler are you going to finish this or somebody needs to take this?

@nicosampler
Copy link
Contributor Author

I've been working on it, and I got stuck working with the debounce function, for some reason (that could not discover yet), the function is being re-created due to a re-render all the time and that force the requests to be triggered all the time.

Feel free to take a look, I'm working with TXs now.

@mmv08
Copy link
Member

mmv08 commented Jul 16, 2020

I got stuck working with the debounce function, for some reason

In that case you should ask for help, we can't help if we don't know you need it

@nicosampler
Copy link
Contributor Author

I did, worked on it with Fernando, then I had to move to another ticket.

@mmv08
Copy link
Member

mmv08 commented Jul 16, 2020

I did, worked on it with Fernando, then I had to move to another ticket.

Working silently with someone on a fix != sharing a problem with a team so anyone can take a look at it

@fernandomg fernandomg marked this pull request as draft July 22, 2020 18:34
@fernandomg fernandomg added Bug 🐛 Something isn't working Major Needs to be fixed for immediate next public release. and removed WIP labels Jul 22, 2020
@ghost
Copy link

ghost commented Jul 22, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

@github-actions
Copy link

github-actions bot commented Jul 23, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 2 0
Ignored 0 N/A
  • Result: ✅ success

  • Annotations: 2 total


[warning] @typescript-eslint/no-non-null-assertion

Disallows non-null assertions using the ! postfix operator


Report generated by eslint-plus-action

@ghost
Copy link

ghost commented Jul 23, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

@ghost
Copy link

ghost commented Jul 24, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

@francovenica
Copy link
Contributor

I still get a chunk of error by writing an ULR. Is not as aggressive like it is in prod where there like 5 error per character you type, but there they are. I don't know how much we can avoid it, so this is just how I see it in this PR right now
image.png

I've tried to type this URL https://ipfs.io/ipfs/QmTgnb1J9FDR9gimptzvaEiNa25s92iQy37GyqYfwZw8Aj/

@fernandomg
Copy link
Contributor

I still get a chunk of error by writing an ULR. Is not as aggressive like it is in prod where there like 5 error per character you type, but there they are. I don't know how much we can avoid it, so this is just how I see it in this PR right now

I've tried to type this URL ipfs.io/ipfs/QmTgnb1J9FDR9gimptzvaEiNa25s92iQy37GyqYfwZw8Aj

Well, we can prevent logging the errors. But sometimes they're useful.

The thing with the number of errors has to do with how fast you type if you take more than 500ms between keystrokes, then you'll have an error per char.

Said so, we can increase the 500ms delay, or set it as an ENV var so it's easier to tweak it when needed? Not sure. @mikheevm, @nicosampler

@nicosampler
Copy link
Contributor Author

It's totally fine log these errors, a partial URL is not a valid safeApp. Regarding the 500ms, I think it's the standard.

@fernandomg fernandomg requested review from mmv08 and Agupane July 24, 2020 20:38
@mmv08
Copy link
Member

mmv08 commented Jul 24, 2020

Yeah I agree that logging these errors is perfectly fine.

@ghost
Copy link

ghost commented Jul 24, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

1 similar comment
@ghost
Copy link

ghost commented Jul 24, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

@francovenica
Copy link
Contributor

Gotcha. Then It's fine for me

@@ -338,7 +338,7 @@ function Apps({ closeModal, closeSnackbar, enqueueSnackbar, openModal }) {
try {
const currentApp = list[index]

const appInfo: any = await getAppInfoFromUrl(currentApp.url)
const appInfo: SafeApp = await getAppInfoFromUrl(currentApp.url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the type here will be inferred

also, removed the expected type for the `getAppInfoFromOrigin` calls as it is inferred
@ghost
Copy link

ghost commented Jul 29, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

@ghost
Copy link

ghost commented Jul 30, 2020

Travis automatic deployment:
https://pr1021--safereact.review.gnosisdev.com/app

@mmv08 mmv08 merged commit 251da31 into development Jul 30, 2020
@mmv08 mmv08 deleted the issue-999 branch July 30, 2020 14:28
@mmv08 mmv08 mentioned this pull request Aug 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 🐛 Something isn't working Major Needs to be fixed for immediate next public release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Safe Apps] Debounce of input for custom Safe app url not properly working
5 participants