@ozen-ui/kit
Version:
React component library
24 lines (23 loc) • 1.04 kB
JavaScript
import React from 'react';
import { logger } from '@ozen-ui/logger';
import { isDev } from '../../../../constants/environment';
import { useStoredValue } from '../../../../hooks/useStoredValue';
import { shallowEqual } from '../../../../utils/shallowEqual';
import { OzenSSRContext } from './OzenSSRContext';
export var OzenSSRProvider = function (_a) {
var children = _a.children, config = _a.config;
if (isDev) {
// eslint-disable-next-line react-hooks/rules-of-hooks
var originalConfig = useStoredValue(config);
var isEqualConfigs = shallowEqual(originalConfig.current, config);
if (!isEqualConfigs) {
logger.error('Конфиг SSR отличается от изначального, он не может меняться динамически!', {
original: originalConfig.current,
current: config,
});
}
}
return (React.createElement(OzenSSRContext.Provider, { value: {
config: config,
} }, children));
};