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(widget-builder): Validate widget before saving #82807

Merged
merged 4 commits into from
Jan 3, 2025

Conversation

nikkikapadia
Copy link
Member

We're reusing the validateWidget function that is being used in the current widget builder. I've added that validation check to the save button so it will validate before carrying out the saving and closing process. When the widget is not valid it displays the message as such:

image

In future PRs I will implement field highlighting for the fields that are causing validation errors.

Related to #81729

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 2, 2025
@nikkikapadia nikkikapadia marked this pull request as ready for review January 3, 2025 15:05
@nikkikapadia nikkikapadia requested a review from a team as a code owner January 3, 2025 15:05
Copy link
Member

@narsaynorath narsaynorath left a comment

Choose a reason for hiding this comment

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

Do you know if there's a way to surface the validation errors in the form a bit better? I think the current widget builder can highlight which fields have issues

That might need more UI changes but we should highlight those errored fields eventually

await validateWidget(api, organization.slug, widget);
onSave({index: Number(widgetIndex), widget});
} catch (error) {
addErrorMessage('Unable to save widget');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
addErrorMessage('Unable to save widget');
addErrorMessage(t('Unable to save widget'));

Copy link

codecov bot commented Jan 3, 2025

Bundle Report

Changes will increase total bundle size by 159.4kB (0.5%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
app-webpack-bundle-array-push 32.18MB 159.4kB (0.5%) ⬆️

@nikkikapadia nikkikapadia enabled auto-merge (squash) January 3, 2025 16:59
@nikkikapadia nikkikapadia merged commit acb50e9 into master Jan 3, 2025
43 checks passed
@nikkikapadia nikkikapadia deleted the nikki/feat/widget-builder-validation branch January 3, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants