-
Notifications
You must be signed in to change notification settings - Fork 112
chore: display no access error #189
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
Conversation
Reviewer's GuideRefactors workspace access handling to distinguish unauthorized tokens from no-access errors and plumbs detailed access error information through the app context into the RequestAccess UI so it can display backend-provided error messages. Sequence diagram for workspace access error handling and routingsequenceDiagram
actor User
participant AppShell
participant useWorkspaceData
participant BackendAPI
participant AuthInternal
participant Router
User->>AppShell: Open workspace
AppShell->>useWorkspaceData: initialize_hook
useWorkspaceData->>BackendAPI: fetchAppOutline()
BackendAPI-->>useWorkspaceData: error(code, message)
alt Unauthorized_token_1024
useWorkspaceData->>AuthInternal: invalidToken()
useWorkspaceData->>Router: navigate(/login)
Router-->>User: Show_login_page
else No_access_1012
useWorkspaceData->>useWorkspaceData: setRequestAccessError(code, message)
useWorkspaceData-->>AppShell: requestAccessError_in_state
AppShell->>AppShell: render_AppContextConsumer_with_error
AppShell->>User: Show_RequestAccess_page_with_error_message
else Other_error
useWorkspaceData->>useWorkspaceData: log_error_and_fallback
AppShell->>User: Show_generic_error_or_fallback
end
Class diagram for updated workspace access error handlingclassDiagram
class RequestAccessError {
+number code
+string message
}
class useWorkspaceData {
-View[] outline
-View[] favoriteViews
-View[] recentViews
-View[] trashList
-DatabaseRelations workspaceDatabases
-RequestAccessError requestAccessError
+loadOutline()
+loadFavoriteViews()
+loadRecentViews()
+loadTrashViews()
}
class AppBusinessLayer {
-RequestAccessError requestAccessError
+AppBusinessLayer(children)
}
class AppContextConsumerProps {
+ReactNode children
+RequestAccessError requestAccessError
+string openModalViewId
+setOpenModalViewId(id)
+Record_awarenessMap awarenessMap
}
class AppContextConsumer {
+AppContextConsumer(props)
}
class RequestAccessProps {
+RequestAccessError error
}
class RequestAccess {
+RequestAccess(props)
}
class RequestAccessContentProps {
+string viewId
+string workspaceId
+RequestAccessError error
}
class RequestAccessContent {
+RequestAccessContent(props)
}
useWorkspaceData --> RequestAccessError : uses
AppBusinessLayer --> useWorkspaceData : consumes_hook
AppBusinessLayer --> AppContextConsumer : passes_requestAccessError
AppContextConsumer --> RequestAccess : renders_with_error
RequestAccess --> RequestAccessContent : passes_error
RequestAccessContent --> RequestAccessError : reads_error_details
AppContextConsumer ..> AppContextConsumerProps : props_type
RequestAccess ..> RequestAccessProps : props_type
RequestAccessContent ..> RequestAccessContentProps : props_type
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- In
RequestAccessContent, theerrorprop is accepted and renamed to_errorbut never used; either consume the error to drive UI/state or remove the prop to avoid dead code and confusion. - The
RequestAccessErrorinterface is defined inuseWorkspaceDatabut consumed across multiple UI components; consider moving this type to a shared types/module file to avoid tight coupling of hooks and presentation layers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `RequestAccessContent`, the `error` prop is accepted and renamed to `_error` but never used; either consume the error to drive UI/state or remove the prop to avoid dead code and confusion.
- The `RequestAccessError` interface is defined in `useWorkspaceData` but consumed across multiple UI components; consider moving this type to a shared types/module file to avoid tight coupling of hooks and presentation layers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
* chore: display no access error * chore: add storybook * chore: fix test
Description
Checklist
General
Testing
Feature-Specific
Summary by Sourcery
Handle workspace access errors more granularly and surface detailed no-access information in the request access flow.
Bug Fixes:
Enhancements: