Skip to content

fix(language-core): only exclude already-set props from inherited attrs when checkRequiredFallthroughAttributes is enabled#6088

Merged
KazariEX merged 1 commit into
vuejs:masterfrom
KazariEX:fix/issue-6082
Jun 4, 2026
Merged

fix(language-core): only exclude already-set props from inherited attrs when checkRequiredFallthroughAttributes is enabled#6088
KazariEX merged 1 commit into
vuejs:masterfrom
KazariEX:fix/issue-6082

Conversation

@KazariEX

@KazariEX KazariEX commented Jun 4, 2026

Copy link
Copy Markdown
Member

fix #6082

@KazariEX KazariEX merged commit 9bc36fc into vuejs:master Jun 4, 2026
5 checks passed
@KazariEX KazariEX deleted the fix/issue-6082 branch June 4, 2026 10:45
@GrantGryczan

GrantGryczan commented Jun 4, 2026

Copy link
Copy Markdown

Does this really fix the issue? It looks like if checkRequiredFallthroughAttributes is enabled, the same bug would occur, since the code is the same. The behavior described in #6082 is not the correct behavior with checkRequiredFallthroughAttributes enabled either.

@KazariEX

KazariEX commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

When this option is enabled, inheriting all props from the inner component unchanged can still report required props as missing when the wrapper component is used, even if those required props have already been passed through. Excluding them is therefore reasonable.

If you still need these props to be externally overridable, define them explicitly.

@GrantGryczan

GrantGryczan commented Jun 4, 2026

Copy link
Copy Markdown

I thought they would simply be changed the optional props, no? That was the impression I got from the documentation.

@KazariEX

KazariEX commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

If it becomes optional and a prop with the same name is also explicitly defined, the two prop types will be merged into a union. This behavior was mentioned in #5882 (comment).

@GrantGryczan

Copy link
Copy Markdown

I see. I'm not sure that's ideal, but I suppose I'll find out if it actually causes any problems once this patch releases, since I do have that option enabled in my project. As long as the errors I indicated in my issue still go away, it's probably fine, at least for now.

In any case, thanks so much for the quick response! I really appreciate how well-maintained you keep this library. :)

@KazariEX

KazariEX commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

This is an artifact of the current codegen colliding with a TS quirk. It would of course be nice to avoid it, but doing so could introduce significantly more complex codegen logic and potential TS performance issues, so I chose to sidestep it.

@KazariEX

KazariEX commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

Thanks for your understanding :)

@GrantGryczan

GrantGryczan commented Jun 9, 2026

Copy link
Copy Markdown

Yeah, I updated and it looks like I was right. The error still occurs when checkRequiredFallthroughAttributes is enabled. Can you not somehow use Omit<X, keyof Y> & Y, where X is the inherited props and Y is the explicit props? That way props with the same name wouldn't merge. I'm not familiar with the implementation. But at the very least, I suspect a non-asymptotic performance degradation isn't a huge concern since this is an opt-in feature, and performance was already the documented reason you wouldn't want to enable fallthroughAttributes by default in the first place.

I can open a new issue for this if desirable.

@KazariEX

Copy link
Copy Markdown
Member Author

Feel free to open a new one.

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.

Regression: fallthroughAttributes now excludes attributes inherited from a child component with props set

2 participants