format project

This commit is contained in:
Kurt Hutten
2021-08-08 19:55:05 +10:00
parent 802ea61639
commit 078c79d8ee
5 changed files with 23 additions and 12 deletions

View File

@@ -1,7 +1,9 @@
let timeoutId = 0 let timeoutId = 0
const DelayedPingAnimation = ({isLoading: isLoading}: {isLoading: boolean}) => { const DelayedPingAnimation = ({
isLoading: isLoading,
}: {
isLoading: boolean
}) => {
const [showLoading, setShowLoading] = React.useState(false) const [showLoading, setShowLoading] = React.useState(false)
React.useEffect(() => { React.useEffect(() => {
if (!isLoading && showLoading) { if (!isLoading && showLoading) {
@@ -18,7 +20,8 @@ const DelayedPingAnimation = ({isLoading: isLoading}: {isLoading: boolean}) => {
} }
}, [isLoading]) }, [isLoading])
if (showLoading && isLoading) return ( if (showLoading && isLoading)
return (
<div className="inset-0 absolute flex items-center justify-center"> <div className="inset-0 absolute flex items-center justify-center">
<div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div> <div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div>
</div> </div>

View File

@@ -129,7 +129,11 @@ export const render: DefaultKernelExport['render'] = async ({
scriptWorker.postMessage({ action: 'init', baseURI, alias: [] }) scriptWorker.postMessage({ action: 'init', baseURI, alias: [] })
} }
if (parameters && currentParameters && JSON.stringify(parameters) !== JSON.stringify(currentParameters)) { if (
parameters &&
currentParameters &&
JSON.stringify(parameters) !== JSON.stringify(currentParameters)
) {
// we are not evaluating code, but reacting to parameters change // we are not evaluating code, but reacting to parameters change
scriptWorker.postMessage({ scriptWorker.postMessage({
action: 'updateParams', action: 'updateParams',

View File

@@ -175,7 +175,11 @@ export const useIdeState = (): [State, (actionOrThunk: any) => any] => {
case 'updateCode': case 'updateCode':
return { ...state, code: payload } return { ...state, code: payload }
case 'healthyRender': case 'healthyRender':
const currentParameters = (payload.currentParameters && Object.keys(payload.currentParameters).length) ? payload.currentParameters : state.currentParameters const currentParameters =
payload.currentParameters &&
Object.keys(payload.currentParameters).length
? payload.currentParameters
: state.currentParameters
return { return {
...state, ...state,
objectData: { objectData: {