Almin

Almin

  • Docs
  • API
  • Blog
  • Help
  • GitHub

›Troubleshooting

Introduction

  • Getting Started
  • Components of Almin
  • Principles
  • Hello World

Tutorial

  • Example projects
  • Counter Tutorial
  • Todo App tutorial

Guides

  • Logging
  • Nesting UseCase
  • Performance profile
  • Strict mode
  • UseCase LifeCycle
  • TypeScript

Troubleshooting

  • UseCase is already released

Appendix

  • GLOSSARY

API

  • API Index
  • Context
  • Dispatcher
  • DispatcherPayloadMeta
  • LifeCycleEventHub
  • Store
  • StoreGroup
  • UseCase
  • UseCaseContext
  • UseCaseExecutor
Edit

UseCase is already released

There are a couple of likely reasons this warning could be appearing:

  • When child use-case is completed after parent use-case did completed

Bad:

        P: Parent UseCase
        C: Child UseCase

                        P fin.   C fin.
        |---------------|          |
        P    |                     |
             C---------------------|
                              |
                          C call dispatch()
class ChildUseCase extends UseCase {
    execute() {
        this.dispatch({ type: "ChildUseCase" });
    }
}
class ParentUseCase extends UseCase {
    execute() {
        // ChildUseCase is independent from Parent
        // But, ChildUseCase is executed from Parent
        // This is programming error
        setTimeout(() => {
            this.context.useCase(new ChildUseCase()).execute();
        }, 16);
        return Promise.resolve();
    }
}

Good:

        P: Parent UseCase
        C: Child UseCase

                       C fin.       P fin.
        |---------------|------------|
        P    |          |
             C----------
                   |
               C call dispatch()    

class ChildUseCase extends UseCase {
    execute() {
        this.dispatch({ type: "ChildUseCase" });
    }
}
class ParentUseCase extends UseCase {
    execute() {
        // Parent wait for Child is completed
        return this.context.useCase(new ChildUseCase()).execute();
    }
}
← TypeScriptGLOSSARY →
Almin
Docs
Getting StartedTutorialAPI Reference
Community
User ShowcaseStack OverflowTwitter
GitHub
GitHubReleasesIssuesStar
Copyright © 2021 azu