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

Fix AVS Details tab navigation #148

Merged
merged 3 commits into from
Jul 30, 2024
Merged

Fix AVS Details tab navigation #148

merged 3 commits into from
Jul 30, 2024

Conversation

vincenthongzy
Copy link
Collaborator

@vincenthongzy vincenthongzy commented Jul 26, 2024

Fixes #137

  1. Now changing tabs will update the url path with an extra path parameter. This parameter is optional.
  • old : /avs/:address
  • new: /avs/:address/tvl & /avs/:address/operators
  1. To keepthings sane, we keep two entries on the history stack:
  • /tvl tab
  • /operators tab <--- this gets replaced when search params change instead of pushing new entries
  1. Now users will just paste this link to directly access the table
    http://localhost:5173/avs/0x870679e138bcdf293b7ff14dd44b70fc97e12fc0/operators?page=1&sort=-tvl

src/App.jsx Outdated
Comment on lines 21 to 34
const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<Layout />}>
<Route index element={<Home />} />
<Route path="/avs" element={<AVSList />} />
<Route path="/avs/:address/:tab?" element={<AVSDetails />} />
<Route path="/lrt" element={<LRT />} />
<Route path="/operators" element={<OperatorsList />} />
<Route path="/operators/:address" element={<OperatorDetails />} />
<Route path="/lst" element={<LST />} />
<Route path="*" element={<NotFound />} />
</Route>
)
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved this up as per https://reactrouter.com/en/main/routers/router-provider. I need to access the router instance


export default function App() {
log.debug('Starting up');

return (
<NextUIProvider>
<NextUIProvider navigate={router.navigate}>
Copy link
Collaborator Author

@vincenthongzy vincenthongzy Jul 26, 2024

Choose a reason for hiding this comment

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

So that the href in Tab can work properly. The docs say this is "PRIVATE - DO NOT USE" , but its perfectly fine to use as per the maintainer.

If we are not feeling comfortable with using this "unstable" API, we would have to remove the usage of createBrowserRouter and RouterProvider and use <BrowserRouter/> instead. From what I can tell, we don't use any of the fancy data API features provided by RouterProvider so switching should not break anything. More info here

Copy link
Contributor

@rubo rubo left a comment

Choose a reason for hiding this comment

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

Good job!

@rubo rubo merged commit eae9b7e into main Jul 30, 2024
1 check failed
@rubo rubo deleted the fix/avs-tabs-navigation branch July 30, 2024 18:48
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 this pull request may close these issues.

Navigation misbehavior on AVS details view
2 participants