Skip to content

Conversation

@gaolinai8888
Copy link
Contributor

@gaolinai8888 gaolinai8888 commented Oct 24, 2025

Description

Fixed type errors in ProcessingFormDialog and SymbologyDialog components.
Updated useRef hooks with proper typing to avoid any and undefined issues.

Checklist

  • PR has a descriptive title and content.
  • PR description contains references to any issues the PR resolves, e.g. Resolves #XXX.
  • PR has one of the labels: documentation, bug, enhancement, feature, maintenance
  • Checks are passing.
    Failing lint checks can be resolved with:
    • pre-commit run --all-files
    • jlpm run lint

📚 Documentation preview: https://jupytergis--967.org.readthedocs.build/en/967/
💡 JupyterLite preview: https://jupytergis--967.org.readthedocs.build/en/967/lite

@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch gaolinai8888/jupytergis/fix-types

);
const formErrorSignal = React.useRef<
Signal<Dialog<any>, boolean> | undefined
>(undefined);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These refs are pretty well-typed already. useRef's default for initialValue is undefined.

props.formErrorSignalPromise?.promise,
props.formErrorSignalPromise
? props.formErrorSignalPromise.promise
: Promise.resolve(undefined),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks equivalent to the previous code; is that the case?

});

let FormComponent;
let FormComponent: React.ComponentType<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

(() => {
/* no action needed on cancel */
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused about this change :) Do we need this?

okBtn.setAttribute('disabled', '');
} else {
okBtn.removeAttribute('disabled');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go back to the way it was. This change checks if (invalid) when we already know invalid is truthy:

if (invalid) {
  // ...
  if (invalid) {
    // We already know this is true
  } else {
    // We handle the else case just below
  }
} else {
  //...
}

}

private okSignal: Signal<Dialog<any>, number>;
private okSignal: Signal<Dialog<IDict>, number>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const [selectedLayer, setSelectedLayer] = useState<string | null>(null);
const [componentToRender, setComponentToRender] = useState<any>(null);
const [componentToRender, setComponentToRender] =
useState<JSX.Element | null>(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

useState<JSX.Element | null>(null);

let LayerSymbology: React.JSX.Element;
let LayerSymbology: React.JSX.Element | null = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave this as it was. componentToRender starts off as null, so it makes sense for its type to be JSX.Element | null, but LayerSymbology will always be a JSX.Element thanks to the case statement around line 87

@mfisher87
Copy link
Member

Thanks Annie!

TODOs: Rebase so only commit 8350d2a is included. Let me know if I can help!

@github-actions
Copy link
Contributor

Integration tests report: appsharing.space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants