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

Cancellation of aff action #45

Open
kamoii opened this issue Jun 4, 2020 · 7 comments
Open

Cancellation of aff action #45

kamoii opened this issue Jun 4, 2020 · 7 comments
Assignees

Comments

@kamoii
Copy link

kamoii commented Jun 4, 2020

The following Widget consists of an aff action that takes some time and a button to cancel it.
I thought it would kill aff action if I pressed the cancel button while aff action was running, but it didn't stop even after cancel, and "done" was shown in the log.
Is this an intented behaviour?

testWidget :: forall a. Widget HTML a
testWidget = do
  result <- orr
       [ "canceled" <$ button [ onClick ] [ text "cancel" ]
       , liftAff affAction
       ]
  text result
  where
    -- long taking action
    affAction = do
      delay (Milliseconds 5000.0)
      log  "done"
      pure "done"
@ajnsit
Copy link
Member

ajnsit commented Jun 4, 2020

That seems like a bug. I'll check it out.

@ajnsit ajnsit self-assigned this Jun 4, 2020
@kamoii
Copy link
Author

kamoii commented Jun 6, 2020

@ajnsit Thanks for your reply!
Would it be OK to create a PR to add a test for this issue?
If I'm not mistaken, it's a problem with the implementation of purescript-concur-core so I'd like to submit the PR to purescript-concur-core.

@ajnsit
Copy link
Member

ajnsit commented Jun 6, 2020

Yeah go ahead!

@ajnsit
Copy link
Member

ajnsit commented Jun 6, 2020

It's definitely an issue with purescript-aff as it's not cancelling the pending timer. I have been thinking about ripping Aff out from concur, atleast concur-core, as it's a big ball of (buggy) JS and prevents us from using Concur for non-js compile targets. I'll also spend some time on doing that.

@ajnsit
Copy link
Member

ajnsit commented Jun 6, 2020

@kamoii I have a work in progress aff-less implementation here - https://github.com/purescript-concur/purescript-concur-core/tree/callbacks

@kamoii
Copy link
Author

kamoii commented Jun 6, 2020

@ajnsit

I have been thinking about ripping Aff out from concur, atleast concur-core, as it's a big ball of (buggy) JS and prevents us from using Concur for non-js compile targets.

I'm not sure how targeting non-js backend works, but does it mean we have to remove all dependencies including non-direct ones that uses js bindings? If thats true, I have a feeling it's going to be a tough path.

@ajnsit
Copy link
Member

ajnsit commented Jun 6, 2020

Well the hope is that atleast some of the popular libraries will get ported to the new backend by others. One good thing is that Concur-core has very limited dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants