diff --git a/package.json b/package.json index 6bb6302d5..4a34b3b38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stated-bean", - "version": "0.1.2-alpha.1", + "version": "0.1.2-alpha.2", "repository": "git@github.com:mjolnirjs/stated-bean.git", "license": "MIT", "main": "dist/cjs", diff --git a/src/hooks/useStatedBean.ts b/src/hooks/useStatedBean.ts index 1e8d1be1e..6c92978b1 100644 --- a/src/hooks/useStatedBean.ts +++ b/src/hooks/useStatedBean.ts @@ -24,10 +24,14 @@ export function useStatedBean( if (option.scope === StatedBeanScope.CONTEXT) { container = context.container; + } else if (option.scope === StatedBeanScope.REQUEST) { + container = new StatedBeanContainer(); + container.register(type); } else { container = context.container || new StatedBeanContainer(); container.register(type); } + return container; }, [option.scope, context.container, type]); const [container, setContainer] = useState(