Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
R1c4rdCo5t4 committed Jun 24, 2024
1 parent 5e89892 commit c9491bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions code/client/src/contexts/error/ErrorContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useState, createContext, useEffect } from 'react';
import { useState, createContext, useEffect, useCallback } from 'react';
import ErrorComponent from '@ui/components/error/Error';

const ERROR_TIMEOUT = 5000;
Expand All @@ -19,7 +19,7 @@ export const ErrorContext = createContext<ErrorContextType>({
export function ErrorProvider({ children }: { children: React.ReactNode }) {
const [error, setError] = useState<Error | undefined>();

async function errorHandler<T>(fn: () => T): Promise<T> {
async function errorHandlerFunction<T>(fn: () => T): Promise<T> {
try {
return await fn();
} catch (e) {
Expand All @@ -28,6 +28,8 @@ export function ErrorProvider({ children }: { children: React.ReactNode }) {
}
}

const errorHandler = useCallback(errorHandlerFunction, []);

useEffect(() => {
if (!error) return;
console.error(error);
Expand Down
10 changes: 5 additions & 5 deletions code/client/src/ui/components/spinner/Spinner.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.spinner {
border: 8px solid #f3f3f3;
border-top: 8px solid lightgray;
border: 5px solid #f3f3f3;
border-top: 5px solid lightgray;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
width: 30px!important;
height: 30px!important;
animation: spin 1s linear infinite;
margin: auto;
}

Expand Down

0 comments on commit c9491bb

Please sign in to comment.