Introduce ComponentState (#4386)
* Proof of concept ComponentState * Migrate to createState and createFamilyState * Refactor * Fix * Fix tests * Fix lint * Fix tests * Re-enable coverage
This commit is contained in:
@ -8,7 +8,7 @@ type IconsProviderProps = {
|
||||
};
|
||||
|
||||
export const IconsProvider = ({ children }: IconsProviderProps) => {
|
||||
const setIcons = useSetRecoilState(iconsState);
|
||||
const setIcons = useSetRecoilState(iconsState());
|
||||
|
||||
useEffect(() => {
|
||||
import('../constants/index').then((lazyLoadedIcons) => {
|
||||
|
||||
@ -4,7 +4,7 @@ import { Icon123 } from '@/ui/display/icon';
|
||||
import { iconsState } from '@/ui/display/icon/states/iconsState';
|
||||
|
||||
export const useIcons = () => {
|
||||
const icons = useRecoilValue(iconsState);
|
||||
const icons = useRecoilValue(iconsState());
|
||||
const defaultIcon = Icon123;
|
||||
|
||||
const getIcons = () => {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
import { IconComponent } from '@/ui/display/icon/types/IconComponent';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
export const iconsState = atom<Record<string, IconComponent>>({
|
||||
export const iconsState = createState<Record<string, IconComponent>>({
|
||||
key: 'iconsState',
|
||||
default: {},
|
||||
defaultValue: {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user