Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Twiineenock committed Jan 21, 2025
1 parent a9a9134 commit 9d64cfb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { type ComponentType, type ErrorInfo, Suspense } from 'react';
import { I18nextProvider } from 'react-i18next';
import { SWRConfig } from 'swr';
import { SWRConfig, type SWRConfiguration } from 'swr';
import type {} from '@openmrs/esm-globals';
import { openmrsFetch } from '@openmrs/esm-api';
import { ComponentContext, type ComponentConfig, type ExtensionData } from './ComponentContext';
Expand Down Expand Up @@ -31,6 +31,7 @@ export interface ComponentDecoratorOptions {
featureName: string;
disableTranslations?: boolean;
strictMode?: boolean;
swrConfig?: Partial<Omit<SWRConfiguration, 'fetcher'>>;
}

export interface OpenmrsReactComponentProps {
Expand Down Expand Up @@ -98,9 +99,10 @@ export function openmrsComponentDecorator<T>(userOpts: ComponentDecoratorOptions
// TO-DO have a UX designed for when a catastrophic error occurs
return <div>An error has occurred. Please try reloading the page.</div>;
} else {
const swrConfig = { ...defaultSwrConfig, ...opts.swrConfig };
const content = (
<Suspense fallback={null}>
<SWRConfig value={defaultSwrConfig}>
<SWRConfig value={swrConfig}>
<ComponentContext.Provider value={this.state.config}>
{opts.disableTranslations ? (
<Comp {...this.props} />
Expand All @@ -120,7 +122,7 @@ export function openmrsComponentDecorator<T>(userOpts: ComponentDecoratorOptions
</SWRConfig>
</Suspense>
);

if (!opts.strictMode || !React.StrictMode) {
return content;
} else {
Expand Down

0 comments on commit 9d64cfb

Please sign in to comment.