Skip to content

SSL Support: Refactor certificate trust selector - #1325

Merged
gavande1 merged 15 commits into
trunkfrom
hide/ssl-help-trusted-certificate-refactor
May 7, 2025
Merged

SSL Support: Refactor certificate trust selector#1325
gavande1 merged 15 commits into
trunkfrom
hide/ssl-help-trusted-certificate-refactor

Conversation

@gavande1

@gavande1 gavande1 commented May 5, 2025

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Refactor certificate trust select to use Redux Store

Testing Instructions

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@gavande1
gavande1 changed the base branch from trunk to hide/ssl-help-trusted-certificate May 5, 2025 13:51
Comment thread src/hooks/use-certificate-trust.ts Outdated

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I support refactoring the "is trusted check" to be part of the Redux state tree 👍 I suggest we look into using the createApi API instead, though (docs).

As I already mentioned, Gergely's #1259 PR should offer up some good inspiration.

Comment thread src/store/slices/certificate-trust.ts Outdated
Comment thread src/store/slices/certificate-trust.ts Outdated
Comment thread src/hooks/use-certificate-trust.ts Outdated
@gavande1
gavande1 force-pushed the hide/ssl-help-trusted-certificate branch from f889895 to 0169e08 Compare May 6, 2025 13:22
@gavande1
gavande1 force-pushed the hide/ssl-help-trusted-certificate-refactor branch from 4faf9d6 to 5926522 Compare May 7, 2025 06:25
@gavande1
gavande1 requested review from a team and fredrikekelund May 7, 2025 06:45
@gavande1
gavande1 force-pushed the hide/ssl-help-trusted-certificate branch from 0169e08 to 977bc7d Compare May 7, 2025 06:49
@gavande1
gavande1 force-pushed the hide/ssl-help-trusted-certificate-refactor branch from 9332c01 to 3182bd5 Compare May 7, 2025 06:50

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is shaping up nicely 👍 I left a couple of quick suggestions.

Comment thread src/hooks/use-certificate-trust.ts Outdated
Comment thread src/stores/certificate-trust-api.ts Outdated
Base automatically changed from hide/ssl-help-trusted-certificate to trunk May 7, 2025 07:28
@gavande1
gavande1 force-pushed the hide/ssl-help-trusted-certificate-refactor branch from 3182bd5 to bbc9b60 Compare May 7, 2025 09:02
@gavande1
gavande1 requested a review from fredrikekelund May 7, 2025 09:18

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple of final tweaks and this should be good to go 👍

We need to add the following to src/stores/index.ts to make the refetchOnFocus option work:

import { setupListeners } from '@reduxjs/toolkit/query';

setupListeners( store.dispatch );
Comment thread src/stores/certificate-trust-api.ts
Comment thread src/stores/certificate-trust-api.ts
error instanceof Error ? error.message : 'Failed to check certificate trust';
return {
error: { data: false, error: errorMessage } as FetchBaseQueryError,
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fredrikekelund, Returning error as you suggested was throwing an error in the console. RTK expects errors in current format.

@gavande1
gavande1 requested a review from fredrikekelund May 7, 2025 11:49

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with a small comment about the structure of the error object returned by checkCertificateTrust 👍

Comment thread src/stores/certificate-trust-api.ts
@gavande1
gavande1 merged commit ecfcd81 into trunk May 7, 2025
@gavande1
gavande1 deleted the hide/ssl-help-trusted-certificate-refactor branch May 7, 2025 12:55
@sentry

sentry Bot commented May 12, 2025

Copy link
Copy Markdown

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ SyntaxError: Unexpected end of JSON input parseWpCliOutput(renderer/main_window/studio/./... View Issue

Did you find this useful? React with a 👍 or 👎

@fredrikekelund

Copy link
Copy Markdown
Contributor

The Sentry issue appears to be unrelated to this PR.

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

Labels

None yet

3 participants