dphfox / Fusion

A modern reactive UI library, built specifically for Roblox and Luau.
https://elttob.uk/Fusion/
MIT License
530 stars 91 forks source link

Remove redundant properties from Best Practices/Components #342

Closed alexasterisk closed 3 weeks ago

alexasterisk commented 4 weeks ago

Remove redundant property Scope from methods called from the inner scope. The Message and Button do not request Scope in their properties, and since scope was overwrote with the inner scope, these are passing the same thing. The inner scope is already being passed in the object orientation.

This functions fine.

scope = scope:innerScope({ ...inner })
scope.Button(scope, { ...props })

This is what it currently is, which doesn't work as Button does not have a field called Scope.

scope = scope:innerScope({ ...inner })
scope.Button(scope, { Scope = scope, ...props })
alexasterisk commented 4 weeks ago

I'm starting to think I'm wrong here? Looks like I've not messed around with v3 enough. I did not notice New returns a function instead of the Instance type anymore.

Or maybe it's because I was dumb and literally only looking at the New return type, even though yes, it's return function is where properties are provided. Which then that function returns the Instance type.