Comments (7)
I just ran into this and came to make sure there was an issue for it. This is what I am doing for now to get around this:
function MyComponent(props)
...
local maid = Maid.new()
local function startPolling()
maid:GiveTask(UserInputService.InputBegan:Connect(...))
end
local frame; frame = New 'Frame' {
...,
[OnEvent 'AncestryChanged'] = function(instance, parent)
if frame == instance then
maid:DoCleaning()
if parent then
startPolling()
end
end
end
}
return frame
end
Which is obviously a bit more bulky than is desirable.
I think the proposed [Cleanup] = {}
is a good solution ✅
from fusion.
I think Fusion should have an in-house Janitor, eliminating the need for any outside libraries.
from fusion.
I think Fusion should have an in-house Janitor, eliminating the need for any outside libraries.
The [Cleanup]
feature should cover all the use cases typically needed by Fusion developers, since the vast majority of other objects garbage collect nicely. In addition, it makes sense to tie cleanup behaviour to instances, given that Fusion's UI system is built entirely around them.
from fusion.
I think Fusion should have an in-house Janitor, eliminating the need for any outside libraries.
The
[Cleanup]
feature should cover all the use cases typically needed by Fusion developers, since the vast majority of other objects garbage collect nicely. In addition, it makes sense to tie cleanup behaviour to instances, given that Fusion's UI system is built entirely around them.
Could be really nice to clean up springs or states forcefully, instead of waiting for the gc to do its job.
from fusion.
I think Fusion should have an in-house Janitor, eliminating the need for any outside libraries.
The
[Cleanup]
feature should cover all the use cases typically needed by Fusion developers, since the vast majority of other objects garbage collect nicely. In addition, it makes sense to tie cleanup behaviour to instances, given that Fusion's UI system is built entirely around them.Could be really nice to clean up springs or states forcefully, instead of waiting for the gc to do its job.
Thing is, because they're entirely garbage-collectable, there's nothing that needs to be cleaned up manually.
from fusion.
Update to this: it seems Roblox themselves are adding a .Destroyed event to Instances, which might make this feature mostly obsolete, except maybe for some keystroke savings. With this in mind, I'm going to be reconsidering whether this feature should be added as part of the core of Fusion anymore, or if it would be better to polyfill the event until it's made more widely available.
I'll see if I can poke at the behaviour of this event a bit more in the meantime.
from fusion.
Update on this - it turns out Destroyed only runs when you invoke :Destroy() on an instance, making it practically useless for Fusion code :(
I'm going to have to advise people away from using the shiny new thing, which sucks hard. Either that, or fix Destroyed manually inside the New function.
from fusion.
Related Issues (20)
- Look into fuzzing as part of our testing suite
- Add explanations and breakdowns of example place files
- Spring/Tween flickering with hydrated reference HOT 2
- Seems that Fusion 0.3 rbxm file is marked as 0.2 HOT 2
- Add unit tests for NaN self-similarity
- Computed does not capture dependency when Value created inside the callback HOT 2
- Fusion.Tween does not catch state update in certain cases
- Frozen tables should use reference equality
- Fusion.Children should parent things in batching order HOT 7
- Allow T everywhere we publicly accept StateObject<T> HOT 1
- Dissolve state objects that don't deal with state HOT 4
- Rename CanBeState<T> to be more concise HOT 7
- Dealing with re-entrant updates HOT 2
- Introduce a more efficient connector between state and data model properties
- Heuristic memoisation for state objects HOT 1
- Add debugging protocol for non-invasive inspection
- Change design of Observer to allow pooling listeners HOT 1
- Reuse scopes from primitive computed objects HOT 3
- Test what an ideal scope pool size is HOT 1
- Integrate under-documented APIs into tutorials
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fusion.