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

Bugfix: Don't throw error in FormPreview if assetDatabase is not a UUID #9531

Merged

Conversation

mnholtz
Copy link
Collaborator

@mnholtz mnholtz commented Nov 15, 2024

What does this PR do?

  • Fixes an issue where the FormPreview will throw if a Rich Text field specifies an asset database via mod option, but the option has not be configured (e.g. under "current inputs")

Fixes this 👇

image

@twschiller twschiller added this to the 2.2.1 milestone Nov 15, 2024
@twschiller twschiller added the bug Something isn't working label Nov 15, 2024
@@ -45,7 +45,7 @@ const RichTextWidget: React.FunctionComponent<WidgetProps> = ({
onBlur(id, editor.getHTML());
}}
editable={!(disabled || readonly)}
assetDatabaseId={validateUUID(database)}
assetDatabaseId={typeof database === "string" && isUUID(database) ? database : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave a comment that the database will be an object in the preview when a variable is provided?

@@ -29,7 +29,7 @@ import ErrorToast from "@/components/richTextEditor/ErrorToast";

type EditorProps = EditorProviderProps & {
// A PixieBrix asset database ID to use for uploading images. If not included, the image extension will be disabled.
assetDatabaseId?: UUID;
assetDatabaseId?: UUID | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to need both ? and | null? You could just pass undefined instead of null?

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.81%. Comparing base (8318d74) to head (1134de6).
Report is 519 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9531      +/-   ##
==========================================
+ Coverage   74.24%   75.81%   +1.56%     
==========================================
  Files        1332     1429      +97     
  Lines       40817    43156    +2339     
  Branches     7634     7938     +304     
==========================================
+ Hits        30306    32719    +2413     
+ Misses      10511    10437      -74     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Playwright test results

passed  153 passed
flaky  1 flaky
skipped  2 skipped

Details

report  Open report ↗︎
stats  156 tests across 51 suites
duration  11 minutes, 23 seconds
commit  1134de6
info  For more information on how to debug and view this report, see our readme

Flaky tests

msedge-setup › setup/unaffiliated.setup.ts › authenticate with unaffiliated user

Skipped tests

chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

@twschiller twschiller self-requested a review November 15, 2024 21:57
Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

See comments on readability

Copy link

No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack.

Do not edit this comment manually.

@fungairino
Copy link
Collaborator

Merging the PR to get everything in main before we switch over to pixiebrix-source. Please follow up comments in the new repo.

@fungairino fungairino merged commit 315eed5 into main Nov 18, 2024
33 checks passed
@fungairino fungairino deleted the bugfix/form_preview_error_when_passing_database_as_mod_option branch November 18, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

3 participants