GithubHelp home page GithubHelp logo

Comments (7)

blake-mealey avatar blake-mealey commented on May 8, 2024 2

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.

Gargafield avatar Gargafield commented on May 8, 2024

I think Fusion should have an in-house Janitor, eliminating the need for any outside libraries.

from fusion.

dphfox avatar dphfox commented on May 8, 2024

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.

Gargafield avatar Gargafield commented on May 8, 2024

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.

dphfox avatar dphfox commented on May 8, 2024

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.

dphfox avatar dphfox commented on May 8, 2024

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.

dphfox avatar dphfox commented on May 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.