Skip to content

Commit a9d60b9

Browse files
committed
chore: update package
1 parent 6f74090 commit a9d60b9

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@bluxcc/react",
33
"author": "Blux team",
4-
"version": "0.1.26",
4+
"version": "0.1.27",
55
"homepage": "https://blux.cc",
66
"description": "Connecting to the Stellar Ecosystem and Beyond",
77
"repository": {

src/Provider.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createConfig } from '@bluxcc/core';
2-
import React, { useEffect, useRef } from 'react';
1+
import React, { useEffect, useMemo, useRef } from 'react';
2+
import { createConfig, setAppearance } from '@bluxcc/core';
33

44
import { IConfig } from '@bluxcc/core/dist/types';
55

@@ -11,11 +11,23 @@ type BluxProviderProps = {
1111
export const BluxProvider = ({ config, children }: BluxProviderProps) => {
1212
const hostRef = useRef<null | HTMLDivElement>(null);
1313

14+
const { appearance, ...restConfig } = config ?? {};
15+
const stableRestConfig = useMemo(
16+
() => restConfig,
17+
[JSON.stringify(restConfig)],
18+
);
19+
1420
useEffect(() => {
1521
if (hostRef.current) {
1622
createConfig(config, hostRef.current);
1723
}
18-
}, [hostRef, config]);
24+
}, [hostRef, stableRestConfig]);
25+
26+
useEffect(() => {
27+
if (hostRef.current) {
28+
setAppearance(appearance ?? {});
29+
}
30+
}, [hostRef, appearance]);
1931

2032
return <div ref={hostRef}>{children}</div>;
2133
};

0 commit comments

Comments
 (0)