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

feat(metadata-sidebar): Use error code prop in MetadataInstanceEditor #3921

Merged
merged 6 commits into from
Feb 12, 2025

Conversation

JChan106
Copy link
Contributor

@JChan106 JChan106 commented Feb 11, 2025

Passes down the error code into MetadataInstanceEditor if there's an error extracting suggestions.

@JChan106 JChan106 requested review from a team as code owners February 11, 2025 17:22
tjuanitas
tjuanitas previously approved these changes Feb 11, 2025
@@ -58,6 +65,7 @@ const MetadataInstanceEditor: React.FC<MetadataInstanceEditorProps> = ({
selectedTemplateInstance={template}
setIsUnsavedChangesModalOpen={setIsUnsavedChangesModalOpen}
taxonomyOptionsFetcher={taxonomyOptionsFetcher}
errorCode={errorCode}
Copy link
Contributor

Choose a reason for hiding this comment

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

🔤

@@ -290,6 +291,7 @@ function MetadataSidebarRedesign({
setIsUnsavedChangesModalOpen={setIsUnsavedChangesModalOpen}
taxonomyOptionsFetcher={taxonomyOptionsFetcher}
template={editingTemplate}
errorCode={extractErrorCode}
Copy link
Contributor

Choose a reason for hiding this comment

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

🔤

@@ -214,15 +224,24 @@ function useSidebarMetadataFetcher(
metadata_template: { template_key: templateKey, scope, type: 'metadata_template' },
})) as Record<string, MetadataFieldValue>;
} catch (error) {
if (isUserCorrectableError(error.status)) {
if (error.status === 408) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (error.status === 408) {
if (error.response.status === 408) {

@wpiesiak
Copy link
Contributor

wpiesiak commented Feb 12, 2025

Can you also add clear error handler and trigger it for handleCancel handleTemplateSelect and handleDeleteInstance function in MetadataSidebarRedesign.tsx, so we can avoid propagating error state when switching template instances?

wpiesiak
wpiesiak previously approved these changes Feb 12, 2025
@mergify mergify bot merged commit c604547 into box:master Feb 12, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants