@@ -15,7 +15,8 @@ let currentContextMap: ContextMap = {}
1515let prevContextMap : void | ContextMap = undefined
1616let prevContextEntry : void | ContextEntry = undefined
1717
18- export const getCurrentContextMap = ( ) : ContextMap => currentContextMap
18+ export const getCurrentContextMap = ( ) : ContextMap =>
19+ Object . assign ( { } , currentContextMap )
1920export const getCurrentContextStore = ( ) : ContextStore =>
2021 new Map ( currentContextStore )
2122
@@ -32,7 +33,7 @@ export const flushPrevContextStore = (): void | ContextEntry => {
3233}
3334
3435export const restoreContextMap = ( prev : ContextMap ) => {
35- currentContextMap = prev
36+ Object . assign ( currentContextMap , prev )
3637}
3738
3839export const restoreContextStore = ( prev : ContextEntry ) => {
@@ -50,8 +51,11 @@ export const setCurrentContextStore = (store: ContextStore) => {
5051}
5152
5253export const assignContextMap = ( map : ContextMap ) => {
53- prevContextMap = currentContextMap
54- currentContextMap = Object . assign ( { } , currentContextMap , map )
54+ prevContextMap = { }
55+ for ( const name in map ) {
56+ prevContextMap [ name ] = currentContextMap [ name ]
57+ currentContextMap [ name ] = map [ name ]
58+ }
5559}
5660
5761export const setContextValue = ( context : AbstractContext , value : mixed ) => {
0 commit comments