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

Bug Fix: parseAttribute function uses wrong default value. #182

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

theodesp
Copy link
Member

Description

This is a Regression bug fix caused by this PR.
parseAttribute would use the wrong default value and thus would return a wrong type for GraphQL which would cause 500 errors.

This PR fixes that issue.

How to test

  1. Use the following post content structure:
Screenshot 2024-01-30 at 11 28 58
  1. Try to perform a full query of this page using the following query:
fragment CoreParagraphBlockFragment on CoreParagraph {
  attributes {
    cssClassName
    backgroundColor
    content
    style
    textColor
    fontSize
    fontFamily
    direction
    dropCap
    gradient
    align
  }
}

fragment CoreColumnsBlockFragment on CoreColumns {
  attributes {
    align
    anchor
    layout
    cssClassName
    isStackedOnMobile
    verticalAlignment
    borderColor
    backgroundColor
    fontSize
    fontFamily
    style
    textColor
    gradient
  }
}

fragment CoreColumnBlockFragment on CoreColumn {
  attributes {
    anchor
    borderColor
    backgroundColor
    cssClassName
    fontSize
    fontFamily
    gradient
    layout
    style
    textColor
    verticalAlignment
    width
  }
}

fragment CoreCodeBlockFragment on CoreCode {
  attributes {
    anchor
    backgroundColor
    borderColor
    className
    content
    cssClassName
    fontFamily
    fontSize
    gradient
    lock
    style
    textColor
  }
}

fragment CoreButtonsBlockFragment on CoreButtons {
  attributes {
    cssClassName
    align
    anchor
    fontFamily
    fontSize
    layout
    style
  }
}

fragment CoreButtonBlockFragment on CoreButton {
  attributes {
    anchor
    gradient
    text
    textAlign
    textColor
    style
    fontSize
    fontFamily
    linkTarget
    rel
    url
    backgroundColor
    cssClassName
    linkClassName
  }
}

fragment CoreQuoteBlockFragment on CoreQuote {
  attributes {
    align
    anchor
    backgroundColor
    citation
    className
    fontFamily
    fontSize
    gradient
    lock
    style
    textColor
    value
    cssClassName
  }
}

fragment CoreImageBlockFragment on CoreImage {
  attributes {
    align
    alt
    anchor
    borderColor
    caption
    className
    width
    url
    title
    style
    src
    sizeSlug
    rel
    lock
    linkTarget
    linkDestination
    linkClass
    href
    height
    cssClassName
  }
}

fragment CoreSeparatorBlockFragment on CoreSeparator {
  attributes {
    align
    anchor
    opacity
    gradient
    backgroundColor
    style
    cssClassName
  }
}

fragment CoreListBlockFragment on CoreList {
  attributes {
    anchor
    backgroundColor
    className
    fontFamily
    fontSize
    gradient
    lock
    ordered
    reversed
    start
    style
    textColor
    type
    values
    cssClassName
  }
}

fragment CoreHeadingBlockFragment on CoreHeading {
  attributes {
    align
    anchor
    backgroundColor
    content
    fontFamily
    fontSize
    gradient
    level
    style
    textAlign
    textColor
    cssClassName
  }
}

fragment CreateBlockBlockBFragment on CreateBlockBlockB {
  attributes {
    message
  }
}

query GetPage($databaseId: ID!, $asPreview: Boolean = false) {
  page(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
    title
    content
    editorBlocks {
      name
      __typename
      renderedHtml
      id: clientId
      parentId: parentClientId
      ...CoreParagraphBlockFragment
      ...CoreColumnsBlockFragment
      ...CoreColumnBlockFragment
      ...CoreCodeBlockFragment
      ...CoreButtonsBlockFragment
      ...CoreButtonBlockFragment
      ...CoreQuoteBlockFragment
      ...CoreImageBlockFragment
      ...CoreSeparatorBlockFragment
      ...CoreListBlockFragment
      ...CoreHeadingBlockFragment
      ...CreateBlockBlockBFragment
    }
  }
}
  1. Check that there are no Errors printed in the IDE

@theodesp theodesp requested a review from a team as a code owner January 30, 2024 11:32
Copy link

changeset-bot bot commented Jan 30, 2024

⚠️ No Changeset found

Latest commit: d3df1a5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@theodesp theodesp changed the title Bug Fix: Parsing parseAttribute uses wrong default value. Bug Fix: parseAttribute function uses wrong default value. Jan 30, 2024
Copy link
Contributor

@mindctrl mindctrl left a comment

Choose a reason for hiding this comment

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

Works now. Left a comment about the changeset. I don't think we need one since the bug wasn't released.

@theodesp theodesp merged commit b7d2539 into main Jan 31, 2024
6 of 7 checks passed
@theodesp theodesp deleted the fix-parse-attribute-default-value branch January 31, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants