[SSR Warning Bug] "SSR-optimized slot function detected"
Version
3.0.5
Steps to reproduce
In any SSR'd application that makes use of slots, you should see the erroneous warning.
[Vue warn]: SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.
Solution
A length
check is being applied to a function When using length on a function, it will return the number of arguments.
Since the number of arguments is always 4, it will always return 4.
Since the check looks for a length greater than 1, it will always issue a warning.
...Assuming this length check was intended for an array, not a function.
HOWEVER, if this check was intended and there is some magic going on with the number of arguments.. then please document the $dynamic-slots
config as nothing is coming up on a search (except other confused users) #2970
@HcySunYang sure, close this one or the other to prevent duplication. I just wanted to surface the issue.
@HcySunYang can you please close the other ticket in favor of this one? I provide the (easy) fix and also I'm worried that ticket is buried already.
In SSR it creates super annoying output:
@arpowers in that case, it will make more sense if you open the PR with the fix and the test and reference the other issue which was opened first.