-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: prevent fatal errors with DOMHelpers methods by improving typesafety and returning early #257
fix: prevent fatal errors with DOMHelpers methods by improving typesafety and returning early #257
Conversation
🦋 Changeset detectedLatest commit: c83a124 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@jasonbahl for your review |
@justlevine there is a small conflict there; if you could resolve it, I can merge. Thank you |
The merge-base changed after approval.
@theodesp conflicts resolved ✔️ |
#258 will fix the failing ci Please let me know what else I can do to help advance this ticket. |
@justlevine I merged #258 |
@theodesp I merged |
What
This PR:
DOMHelpers
class to return early if no HTML is passed to the method.DOMHelpers
methods by inlining their types to the method signatures. To maintain back-compatiblity, the old methods have been deprecated, withsnake_case
alternatives created with the stricter signatures.Important
This PR is based on #256 which should be merged first.
The relevant diff for this PR is: 5b59fe3
Why
Without returning early, numerous DIDOM methods we call internally can fatal error. The improved type safety is to prevent this sort of issue leaking through again in the future.
To Test
Add the following placeholder image block to a page (extracted from a TT4 pattern):
Query for
CoreBlockImageAttributes
:Ensure no errors, and
attributes
are returned.Screenshots
Before:
After: