Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/page.tsx (1)
Line range hint
28-33: Consider handling the loading state for a better user experience.The
isLoadingvariable has been removed from the destructured properties returned by theuseSWRhook. This suggests that the component no longer handles the loading state during data fetching, which may negatively impact the user experience if no loading feedback is provided while fetching data.To improve the user experience, consider:
- Destructuring the
isLoadingvariable from theuseSWRhook.- Conditionally rendering a loading spinner or placeholder content when
isLoadingis true.Here's an example of how you can handle the loading state:
const { workspaceSlug, projectId, viewId } = useParams(); // store hooks const { fetchViewDetails, getViewById } = useProjectView(); const { getProjectById } = useProject(); // derived values const projectView = viewId ? getViewById(viewId.toString()) : undefined; const project = projectId ? getProjectById(projectId.toString()) : undefined; const pageTitle = project?.name && projectView?.name ? `${project?.name} - ${projectView?.name}` : undefined; -const { error } = useSWR( +const { data, error, isLoading } = useSWR( workspaceSlug && projectId && viewId ? `VIEW_DETAILS_${viewId.toString()}` : null, workspaceSlug && projectId && viewId ? () => fetchViewDetails(workspaceSlug.toString(), projectId.toString(), viewId.toString()) : null ); +if (isLoading) { + return <LoadingSpinner />; +} if (error) { return ( <EmptyState image={emptyView} title="View does not exist" description="The view you are looking for does not exist or you don't have permission to view it." primaryButton={{ text: "View other views", onClick: () => router.push(`/${workspaceSlug}/projects/${projectId}/views`), }} /> ); }
Summary by CodeRabbit