Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/proud-rings-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@spur.us/monocle-react": patch
---

Fix refresh return type in `MonocleContextType`
8 changes: 4 additions & 4 deletions packages/monocle-react/src/contexts/MonocleProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import React, {
import { withMaxAllowedInstancesGuard } from '../utils';
import { MonocleProviderProps } from '../types';
import { DOMAIN } from '../constants';

interface MonocleContextType {
assessment: string | undefined;
refresh: () => void;
refresh: () => Promise<void>;
isLoading: boolean;
error: Error | null;
}
Expand Down Expand Up @@ -61,10 +62,9 @@ const MonocleProviderComponent: React.FC<MonocleProviderProps> = ({
try {
setIsLoading(true);
setError(null);

if (window.MCL) {
await window.MCL.refresh();
setIsLoading(false);
} else {
throw new Error('MCL object not found on window');
}
Expand Down Expand Up @@ -108,7 +108,7 @@ const MonocleProviderComponent: React.FC<MonocleProviderProps> = ({
if (!assessment) {
initializeMCL();
}

// Cleanup function to reset callback on unmount
return () => {
if (window.MCL) {
Expand Down