-
Notifications
You must be signed in to change notification settings - Fork 196
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(explorer): various fixes #3299
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f90e32f
remove future time
karooolis 9a4c580
404 page if invalid chain
karooolis 2c6f1b9
worlds selector open only if options exist
karooolis 7e05130
add chainName validation to chain layout
karooolis 28d282a
update params
karooolis 65f9ef9
add back refetch intervalf or tables
karooolis f961ac5
improve layout
karooolis 18e24fa
overflow scroll
karooolis e12d9d1
wrap long inputs + logs
karooolis a152668
Create soft-bears-rest.md
karooolis f4299f7
visible ring offset for function field
karooolis 53ded0b
Merge branch 'kumpis/fixes-cleanups' of github.com:latticexyz/mud int…
karooolis 84bdcd5
Update soft-bears-rest.md
karooolis caad349
add nav padding
karooolis d9075cc
Update soft-bears-rest.md
karooolis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@latticexyz/explorer": patch | ||
--- | ||
|
||
- Not found page if invalid chain name. | ||
- Only show selector for worlds if options exist. | ||
- Remove "future time" from transactions table. | ||
- Improved layout for Interact tab. | ||
- Wrap long args in transactions table. | ||
- New tables polling. | ||
- Add logs (regression). |
19 changes: 19 additions & 0 deletions
19
packages/explorer/src/app/(explorer)/[chainName]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use client"; | ||
|
||
import { notFound } from "next/navigation"; | ||
import { isValidChainName } from "../../../common"; | ||
|
||
type Props = { | ||
params: { | ||
chainName: string; | ||
}; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default function ChainLayout({ params: { chainName }, children }: Props) { | ||
if (!isValidChainName(chainName)) { | ||
return notFound(); | ||
} | ||
|
||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 20 additions & 3 deletions
23
packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
"use client"; | ||
|
||
import { notFound } from "next/navigation"; | ||
import { Address } from "viem"; | ||
import { isValidChainName } from "../../../../../common"; | ||
import { Navigation } from "../../../../../components/Navigation"; | ||
import { Providers } from "./Providers"; | ||
import { TransactionsWatcher } from "./observe/TransactionsWatcher"; | ||
|
||
export default function WorldLayout({ children }: { children: React.ReactNode }) { | ||
type Props = { | ||
params: { | ||
chainName: string; | ||
worldAddress: Address; | ||
}; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default function WorldLayout({ params: { chainName }, children }: Props) { | ||
if (!isValidChainName(chainName)) { | ||
return notFound(); | ||
} | ||
|
||
return ( | ||
<Providers> | ||
<Navigation /> | ||
<div className="flex h-screen flex-col"> | ||
<Navigation /> | ||
{children} | ||
</div> | ||
<TransactionsWatcher /> | ||
{children} | ||
</Providers> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { redirect } from "next/navigation"; | ||
import { supportedChainName } from "../../../../../common"; | ||
|
||
type Props = { | ||
params: { | ||
chainName: string; | ||
chainName: supportedChainName; | ||
worldAddress: string; | ||
}; | ||
}; | ||
|
||
export default async function WorldPage({ params }: Props) { | ||
const { chainName, worldAddress } = params; | ||
export default async function WorldPage({ params: { chainName, worldAddress } }: Props) { | ||
return redirect(`/${chainName}/worlds/${worldAddress}/explore`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thoughts on validating the chain name here and only redirect when valid?
this is what causes the
/favicon.ico/worlds
404 errorThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since chain names are known statically, I wonder if its helpful to use
getStaticPaths
on these routes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getStaticPaths
only works withpages
router while we are usingapp
router which is the recommended way now and moving forward.There is something similar in the
app
router calledgenerateStaticParams
which I think we can use the same way. However, I don't think we should make this page static given that the world addresses which we display in world entry page are dynamic.Now
getServerSideProps
insideapp
router is essentially replaced withasync
server-side component with a fetcher function inside. So based on that, the validation also is moved to the component itself. What I think would be best to do here is to actually move the validation insidelayout.tsx
. I already did that for(explorer)/[chainName]/worlds/[worldAddress]/layout.tsx
but actually thinking that same could be done for(explorer)/[chainName]/layout.tsx
(which doesn't exist yet but could be created for the purpose of validation). This way there's less repeating logic at least.