Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Debug tabs behavior #939

Closed
1 task done
rin-st opened this issue Sep 16, 2024 · 2 comments · Fixed by #975
Closed
1 task done

bug: Debug tabs behavior #939

rin-st opened this issue Sep 16, 2024 · 2 comments · Fixed by #975

Comments

@rin-st
Copy link
Member

rin-st commented Sep 16, 2024

Is there an existing issue for this?

Which method was used to setup Scaffold-ETH 2 ?

git clone

Current Behavior

While working on #933 I found very strange behavior: whenever I click on tab with contract, it always change to YourContract tab.

Screen.Recording.2024-09-16.at.12.13.11.mov

It's not because of its index or alphabetical order, it's always YourContract (if you have that tab, of course). Clearing localstorage doesn't help

Expected Behavior

Clicked contract tab should be chosen

Steps To Reproduce

I debugged it and understood that it was because of my other browser tab, which had only YourContract.
So, steps:

  • run default se-2 (with one contract - YourContract)
  • stop your frontend app (but don't close browser tab [tab 1] )
  • add another contract and deployment file for it
  • yarn deploy --reset your contracts (or just yarn deploy if you re-run yarn chain)
  • open new browser tab [tab 2]
  • yarn start your app
  • open it on new browser tab [tab 2]

Anything else?

Not sure if we need to fix it for now since it's relatively rare case and not so easy to fix. But at least we know what causes this

@rin-st
Copy link
Member Author

rin-st commented Sep 16, 2024

The bug is not related to the mentioned PR, it also works on main

@technophile-04
Copy link
Collaborator

Thanks @rin-st!! So the summary is that if this problem occurs people need to make sure they close all other browser TABs with http://localhost:3000 and then refresh the latest one and it should start working. Just tried this and works nicely.

Umm I think instead of relying on usehooks-ts useLocalStorage logic maybe we should write a our custom simple logic for DebugContracts.

The reason I feel usehooks useLocalstorage have this problem is because they are listening to localstroage for all tabs and keeping them in sync :

Screenshot 2024-10-28 at 10 39 34 AM

But since the outdated tab doesn't have the new contract name, it updates the contractName to contractName[0] in outdated tab and latest tab listen to those changes and also updates it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants