- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
chore(dashboard): render main layout as home page for v2 #6823
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
|
} | ||
|
||
const Header = () => { | ||
const { store, isError, error } = useV2Store({}) |
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.
only thing that changes here is the v2Store call. Lmk if this is the desired approach.
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.
LGTM, added a comment on the useV2Store hook, but feel free to ignore it as its not really related to your PR.
@@ -8,7 +8,7 @@ export const useV2Store = ({ initialData }: { initialData?: any }) => { | |||
{ initialData } | |||
) | |||
|
|||
const store = data.stores[0] | |||
const store = data?.stores[0] |
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.
nit: not really related to your PR, but make sense to manually set the error in the case where isLoading is false and the stores array is empty, to have the same effect as if the current useAdminStore endpoint fails. Otherwise, you might end up with a false positive, where loading is completed and no error is thrown, but at the same time store is undefined, causing the admin to break.
if (!isLoading && !isError && typeof store === "undefined") { | ||
throw new Error("Store does not exist") | ||
} |
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.
@kasperkristensen is this what you mean?
Trying to keep these dashboard PRs short.
what:
Currently it renders settings page as the default home page, this PR moves that over to the orders page, which will be currently empty, but it renders the main layout where most of the v2 work will be done