-
-
Notifications
You must be signed in to change notification settings - Fork 94
feat(plugins): add connectors always on plugin #138
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
base: nxt
Are you sure you want to change the base?
Conversation
| spaRouteChangeCompleteSubscribe( | ||
| async (url) => { | ||
| const location = whereAmI(url); | ||
|
|
||
| // Only apply to home page, not spaces | ||
| if (location !== "home") return; | ||
|
|
||
| // Get current sources | ||
| const currentState = internalSearchStatesObserverStore.getState(); | ||
| let currentSources = currentState.sources; | ||
|
|
||
| // If sources is empty (Perplexity hasn't initialized yet), use web as default | ||
| if (currentSources.length === 0) { | ||
| currentSources = ["web"]; | ||
| } | ||
|
|
||
| // Add all configured connectors that aren't already present | ||
| const connectorsToAdd = connectorsToEnable.filter( | ||
| (connector) => !currentSources.includes(connector), | ||
| ); | ||
|
|
||
| if (connectorsToAdd.length > 0) { | ||
| const updatedSources = [...currentSources, ...connectorsToAdd]; | ||
| internalSearchStatesObserverStore.getState().setInternalSearchStates({ | ||
| sources: updatedSources, | ||
| }); | ||
| console.log( | ||
| "[Complexity] Added connectors to sources:", | ||
| connectorsToAdd, | ||
| "-> Result:", | ||
| updatedSources, | ||
| ); | ||
| } else { | ||
| console.log("[Complexity] All configured connectors already enabled"); | ||
| } | ||
| }, | ||
| { | ||
| immediate: true, | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 MEDIUM - Async callback lacks error handling
Category: quality
Description:
The async callback passed to spaRouteChangeCompleteSubscribe has no try-catch wrapper, risking unhandled promise rejections if operations fail
Suggestion:
Wrap the async callback body in try-catch block to handle potential errors from store operations. Example: async (url) => { try { /* existing code */ } catch (err) { logger.error('[Complexity] Failed to update connectors', {err}); } }
Confidence: 65%
Rule: ts_handle_async_operations_with_proper_erro
| console.log( | ||
| "[Complexity] Added connectors to sources:", | ||
| connectorsToAdd, | ||
| "-> Result:", | ||
| updatedSources, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 MEDIUM - console.log left in production code
Category: quality
Description:
Debug console.log statement should be removed or replaced with proper logger
Suggestion:
Use a proper logger (e.g., logger.info) or remove this debug statement
Confidence: 85%
Rule: general_console_log_committed
| updatedSources, | ||
| ); | ||
| } else { | ||
| console.log("[Complexity] All configured connectors already enabled"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 MEDIUM - console.log left in production code
Category: quality
Description:
Debug console.log statement should be removed or replaced with proper logger
Suggestion:
Use a proper logger (e.g., logger.info) or remove this debug statement
Confidence: 85%
Rule: general_console_log_committed
|
No description provided.