Skip to content

Conversation

@imrishabh18
Copy link
Member

@imrishabh18 imrishabh18 commented Oct 23, 2025

Before

image

After

image

@vercel
Copy link

vercel bot commented Oct 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview Comment Oct 23, 2025 11:01pm

...props,
facingDirection: props.facingDirection ?? "right",
}
super(propsWithDefaults)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't modify props (props are immutable)

Instead, create a function called _getFacingDirection() and force anything using facing direction to use that. This allows much cleaner overrides and preserves the user's definitions (which makes errors and lots of other stuff more clear)

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

see comment

import type { BaseSymbolName } from "lib/utils/constants"

export class PinHeader extends NormalComponent<typeof pinHeaderProps> {
_getFacingDirection(): "left" | "right" | "up" | "down" {
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry

Suggested change
_getFacingDirection(): "left" | "right" | "up" | "down" {
_getSchFacingDirection(): "left" | "right" | "up" | "down" {

// Check for components with _getFacingDirection method (e.g., PinHeader with defaults)
if (
(component as PinHeader)._getFacingDirection &&
typeof (component as PinHeader)._getFacingDirection === "function"
Copy link
Contributor

Choose a reason for hiding this comment

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

this is really incorrect

Copy link
Contributor

Choose a reason for hiding this comment

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

if ((component as PinHeader)?._getFacingDirection()) {

Copy link
Contributor

Choose a reason for hiding this comment

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

or even better

if (component._getSchFacingDirection()) {

then define in the PrimitiveComponent _getFacingSchFacingDirection() { return null }

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

quick video note- happy to huddle on this one

https://share.cleanshot.com/bCslHLFx

@imrishabh18 imrishabh18 force-pushed the default-pinheader-facingDirection branch from b73ea54 to daa1717 Compare October 23, 2025 22:55
@imrishabh18 imrishabh18 changed the title add the default facingDirection to the pinHeader in props for the autolayout Fix the autolayout for the pinHeader component having no explicit facingDirection Oct 23, 2025
@imrishabh18 imrishabh18 merged commit 08a7584 into main Oct 23, 2025
9 checks passed
@imrishabh18 imrishabh18 deleted the default-pinheader-facingDirection branch October 23, 2025 23:05
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