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

Simplify InputOrDisplay.vue component #12000

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

torchiaf
Copy link
Member

@torchiaf torchiaf commented Sep 23, 2024

Summary

On Harvester, we have some errors when using the InputOrDisplay component as a container - probably something related to the use of setup function or dynamic HTML build.

https://github.com/torchiaf/harvester/blob/62da7658669d156d63b0d385a2978ab9d37637de/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCpuMemory.vue#L81-L94

image

The current PR just simplify the implementation and fixes the issue.

After

image

…d in Harvester

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
Copy link
Member

@rak-phillip rak-phillip left a comment

Choose a reason for hiding this comment

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

This change looks good to me.

To be clear about the issue, this is related to Slot Unification in Vue 3 now exposing slots as a function1:

I left a comment on an alternative approach, but I think that we should ultimately use the solution that will be easiest to understand for future maintenance.

Footnotes

  1. https://v3-migration.vuejs.org/breaking-changes/slots-unification.html#overview

h('div', { class: 'value' }, slots.value ? slots.value : displayValue.value)
]);
} else {
return slots.default;
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, we could have invoked the slot as a function via:

return slots.default();

The same would go for the two slots above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Phil, better to know what the error was, I found another case where we need to update the slots API. #12005

@torchiaf torchiaf merged commit ec4c5aa into rancher:master Sep 24, 2024
30 checks passed
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