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

[IMP] stores: add resetStores method #3863

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ class Demo extends Component {
inputFiles[images[i]] = { imageSrc };
}
await this.initiateConnection(inputFiles);
stores.resetStores();
stores.inject(NotificationStore, {
notifyUser: this.notifyUser,
raiseError: this.raiseError,
askConfirmation: this.askConfirmation,
});
this.state.key = this.state.key + 1;

// note : the onchange won't be called if we cancel the dialog w/o selecting a file, so this won't be called.
Expand Down
4 changes: 4 additions & 0 deletions src/store_engine/dependency_container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export class DependencyContainer {
instantiate<T>(Store: StoreConstructor<T>, ...args: StoreParams<StoreConstructor<T>>): T {
return this.factory.build(Store, ...args);
}

resetStores() {
this.dependencies.clear();
}
}

class StoreFactory {
Expand Down