feat(plugins): add connectors always on plugin#138
feat(plugins): add connectors always on plugin#138coleleavitt wants to merge 1 commit intopnd280:nxtfrom
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.
🟡 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.
🟡 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.
🟡 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.