@blac/react
Advanced tools
Comparing version 0.0.21 to 0.0.22
@@ -1,2 +0,2 @@ | ||
import { useId, useMemo, useSyncExternalStore } from 'react'; | ||
import { useId, useMemo, useSyncExternalStore, useEffect } from 'react'; | ||
@@ -333,7 +333,15 @@ var externalBlocStore = function (bloc, dependencySelector) { | ||
get: function () { | ||
var p = this.constructor._propsOnInit; | ||
if (!p) | ||
return {}; | ||
return p; | ||
if (this.localProps) { | ||
return this.localProps; | ||
} | ||
var constructorProps = this.constructor._propsOnInit; | ||
if (constructorProps) { | ||
this.localProps = constructorProps; | ||
return constructorProps; | ||
} | ||
return {}; | ||
}, | ||
set: function (props) { | ||
this.localProps = props; | ||
}, | ||
enumerable: false, | ||
@@ -484,5 +492,5 @@ configurable: true | ||
var state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); | ||
// useEffect(() => { | ||
// resolvedBloc.props = props; | ||
// }, [props]); | ||
useEffect(function () { | ||
resolvedBloc.props = props; | ||
}, [props]); | ||
return [state, resolvedBloc]; | ||
@@ -489,0 +497,0 @@ }; |
@@ -335,7 +335,15 @@ 'use strict'; | ||
get: function () { | ||
var p = this.constructor._propsOnInit; | ||
if (!p) | ||
return {}; | ||
return p; | ||
if (this.localProps) { | ||
return this.localProps; | ||
} | ||
var constructorProps = this.constructor._propsOnInit; | ||
if (constructorProps) { | ||
this.localProps = constructorProps; | ||
return constructorProps; | ||
} | ||
return {}; | ||
}, | ||
set: function (props) { | ||
this.localProps = props; | ||
}, | ||
enumerable: false, | ||
@@ -486,5 +494,5 @@ configurable: true | ||
var state = react.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); | ||
// useEffect(() => { | ||
// resolvedBloc.props = props; | ||
// }, [props]); | ||
react.useEffect(function () { | ||
resolvedBloc.props = props; | ||
}, [props]); | ||
return [state, resolvedBloc]; | ||
@@ -491,0 +499,0 @@ }; |
{ | ||
"name": "@blac/react", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/blac-react.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
104231
995