Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): fix TPM check when using the legacy AutoYaST mode #1927

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

imobachgs
Copy link
Contributor

Problem

When using the legacy AutoYaST mode, the web UI crashes at the end of the installation when trying
to find our whether it is using TPM or not.

Solution

Properly handle that case:

  • fetchConfig now returns null instead of undefined. According to TanStack Query
    documentation
    , queryFn
    Must return a promise that will either resolve data or throw an error. The data cannot be
    undefined
    .
  • usingTpm function now handles the case where the configuration is null.

Testing

  • Tested manually

Copy link
Contributor

@joseivanlopez joseivanlopez left a comment

Choose a reason for hiding this comment

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

LGTM

@imobachgs imobachgs merged commit fa72f8e into master Jan 21, 2025
5 checks passed
@imobachgs imobachgs deleted the fix-using-tpm branch January 21, 2025 09:57
@teclator
Copy link
Contributor

LGTM

@@ -79,6 +79,10 @@ const SuccessIcon = () => <Icon name="check_circle" className="icon-xxxl color-s
// TODO: define some utility method to get the device used as root (drive, partition, logical volume).
// TODO: use type checking for config.
function usingTpm(config): boolean {
if (!config) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note.

Would be nice to be consistent in the way we return early from a component to tell React renders nothing.

I for sure know that no matters if you return undefined or null, React will understand both of them as nothing. But we used to go for

if (something) return;

Which returns undefined, the default return value for a JavaScript function.

Now we've a small dilemma with it comes to consistence because, as stated in the PR, react-query requires the query returns always something (null meaning nothing).

We can, of course, choose a default return value for everything or one for components and another for queries, but betting for consistency in each case for easing code maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants