Nested context providers don't restore previous context value after executing.
import { augmentor, createContext, useContext } from 'augmentor';
const TestContext = createContext();
const RootProvider = augmentor(() => {
TestContext.provide("hello world");
ChildProvider();
Consume();
});
const ChildProvider = augmentor(() => {
TestContext.provide("last update wins");
Consume();
});
const Consume = augmentor(() => {
const message = useContext(TestContext);
console.log(message);
});
RootProvider();
last hello wins
last hello wins
last hello wins
hello world
const RootProvider = augmentor(() => {
TestContext.provide("hello world");
Consume();
ChildProvider();
Consume();
});
hello world
last hello wins
last hello wins
last hello wins