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: slot fallback broken in components built with 2.6.14 running in 2.6.12 #12314

Closed
privatenumber opened this issue Oct 8, 2021 · 4 comments

Comments

@privatenumber
Copy link
Contributor

Version

2.6.14

Reproduction link

Slot fallback broken running in 2.6.12:
https://jsfiddle.net/hirokiosame/dotsp9ak/

Slot fallback working in 2.6.14:
https://jsfiddle.net/hirokiosame/eb16s0hx/

Steps to reproduce

  1. Build the following component with vue-template-compiler v2.6.14:
<template>
	<div>
		test component
		<slot>
			- slot fallback works!
		</slot>
	</div>
</template>
  1. Run component in a Vue.js v2.6.12 app:
<template>
    <test-component />
</template>

<script>
import TestComponent from './TestComponent.js';

export default {
  components: {
  	TestComponent,
  },
}
</script>

What is expected?

For a component built with vue-template-compiler v2.6.14 to be backwards compatible with a Vue.js v2.6.12 runtime.

It's not only no longer working, it actually displays "undefined" in place of the slot fallback.

Since there is no new feature being leveraged, I think it's expected for behavior to be preserved.

What is actually happening?

Slot fallback not working in component built with vue-template-compiler v2.6.14, but running in a Vue.js 2.6.12 app

@posva
Copy link
Member

posva commented Oct 8, 2021

This is expected: templates compiled with version 2.x.y can only be used with version 2.x.y or superior. In other words, your user must use the latest Vue too.

@posva posva closed this as completed Oct 8, 2021
@privatenumber
Copy link
Contributor Author

I would agree if I was leveraging a new feature that's not available in v2.6.12, but I think it's understandable to expect something as fundamental as slots to be backwards compatible.

@posva
Copy link
Member

posva commented Oct 8, 2021

Unfortunately no because that's not how compilation works 😅 . It's a take-all or nothing kind of thing.

There was a fix to slots that created that incompatibility and it has been discussed in other issues already. Sometimes it is possible to make the compilation of templates to be backwards compatible but in this case, the fix (#12014) requires incompatibility.

@privatenumber
Copy link
Contributor Author

I see. If it's not possible because it's a side-effect to fixing an underlying bug then that's understandable too.

Thanks for explaining and referencing the PR.

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

No branches or pull requests

2 participants