Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dworthen committed Nov 29, 2023
1 parent 45d6c20 commit 10a0081
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"files.watcherExclude": {
"**/target": true
},
}
}
1 change: 0 additions & 1 deletion src/renderer/src/components/DataLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const DataLoader: FC = function DataLoader() {
return serialAsync(_getBallots)
}, [_getBallots])


const _getBallot = useCallback(
async (e: CustomEvent<{ ballotId: string }>) => {
try {
Expand Down
7 changes: 1 addition & 6 deletions src/renderer/src/components/SettingsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
Button,
Card,
Field,
Input,
} from '@fluentui/react-components'
import { Button, Card, Field, Input } from '@fluentui/react-components'
import { useAtom, useAtomValue } from 'jotai'
import { FC, FormEvent, useCallback, useState } from 'react'
import { useNavigate } from 'react-router-dom'
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SettingsForm } from '../components/index.js'

export const LoginPage = function LoginPage() {

return <SettingsForm />
}
5 changes: 4 additions & 1 deletion src/shared/lib/functions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export function serialAsync<X extends (...args: any) => Promise<any>>(
fn: X,
): (...args: Parameters<typeof fn>) => Promise<Awaited<ReturnType<typeof fn>>> {
const existingPromises: Record<string, Promise<ReturnType<typeof fn>> | null> = {}
const existingPromises: Record<
string,
Promise<ReturnType<typeof fn>> | null
> = {}
function generatePromise(...args: Parameters<typeof fn>) {
const key = JSON.stringify(args)
// @ts-expect-error error
Expand Down
13 changes: 5 additions & 8 deletions src/shared/lib/records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export function isRecord(obj: unknown): obj is Record<string, unknown> {
return obj != null && typeof obj === 'object' && !Array.isArray(obj)
}


export function mergeDeep<T extends Record<string, unknown> = any>(
target: unknown,
...sources: unknown[]
Expand Down Expand Up @@ -34,7 +33,6 @@ export function mergeDeep<T extends Record<string, unknown> = any>(
return mergeDeep(target, ...sources) as T
}


export function hasRequiredKeys<T extends Record<string, any>>(
obj: T,
keys: Array<string | string[]>,
Expand All @@ -43,12 +41,11 @@ export function hasRequiredKeys<T extends Record<string, any>>(
let pass = true
for (const k of keys) {
const p = Array.isArray(k) ? k : k.split('.')
const value = objectPath.get(
obj,
p,
undefined,
)
if (value === undefined || (typeof value === 'string' && (value as string).trim() === '')) {
const value = objectPath.get(obj, p, undefined)
if (
value === undefined ||
(typeof value === 'string' && (value as string).trim() === '')
) {
pass = false
missingKeys.push(p.join('#'))
}
Expand Down

0 comments on commit 10a0081

Please sign in to comment.