-
Notifications
You must be signed in to change notification settings - Fork 9
Show full-depth reference in CharmDetails panel #931
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
Conversation
…yCharms - Fixed infinite recursion by replacing deep traversal with top-level property scanning - Added proper entity ID tracking to avoid duplicate references - Removed dependency on findAllAliasedDocs which was causing runtime issues - Fixed type issues in tests and cleaned up debug logging - Both reference directions now correctly show all references between charms Fixes #758 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add proper error handling by rethrowing instead of silently failing - Replace comments with TODO items for future recursive implementation - Remove findAllAliasedDocs export that isn't being used - Fix type checking errors in tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Based on PR review feedback in #909 (comment) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>\
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>\
…ndling - Added recursive traversal of sourceCell chains to find resultRefs - Implemented safe traversal to avoid triggering Copy trap errors - Fixed cycle detection by tracking object references directly - Added improved error handling to gracefully handle issues without crashing - Added safeguards to prevent array access issues and property access errors - Limited the maximum number of references to avoid UI overload - Thoroughly tested with nested reference chains Fixes #758
- Refactored to use followAliases and isAlias for better alias handling - Added type checking and proper error boundaries - Used existing utility functions instead of reimplementing them - Reduced code verbosity and improved readability - Safely handles Cell objects to avoid Copy trap errors Continues work on #758
dcce75e to
42d4daa
Compare
| if (Array.isArray(value)) { | ||
| for (let i = 0; i < value.length; i++) { | ||
| // Skip null/undefined items | ||
| if (value[i] == null) continue; | ||
|
|
||
| // Skip items that might be cells to avoid Copy trap | ||
| if (typeof value[i] === 'object' && | ||
| (isCell(value[i]) || isDoc(value[i]) || isCellLink(value[i]))) { | ||
| try { | ||
| // Process each cell directly | ||
| processValue(value[i], parent, new Set([...visited]), depth + 1); | ||
| } catch (err) { | ||
| console.debug(`Error processing special array item at index ${i}:`, err); | ||
| } | ||
| continue; | ||
| } | ||
|
|
||
| // Process regular items | ||
| try { | ||
| processValue(value[i], parent, new Set([...visited]), depth + 1); | ||
| } catch (err) { | ||
| console.debug(`Error processing array item at index ${i}:`, err); | ||
| } | ||
| } | ||
| } else if (typeof value === 'object') { | ||
| // Process regular object properties | ||
| const keys = Object.keys(value); | ||
| for (let i = 0; i < keys.length; i++) { | ||
| const key = keys[i]; | ||
|
|
||
| // Skip properties that might be or contain Cell objects | ||
| if (key === 'sourceCell' || key === 'cell' || key === 'value' || | ||
| key === 'getAsCellLink' || key === 'getSourceCell') { | ||
| continue; | ||
| } | ||
|
|
||
| try { | ||
| processValue(value[key], parent, new Set([...visited]), depth + 1); | ||
| } catch (err) { | ||
| console.debug(`Error processing object property '${key}':`, err); | ||
| } | ||
| } | ||
| } |
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.
I don't really understand how or why, but I was triggering the copy trap by naively traversing.
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.
Pull Request Overview
This PR aims to enhance the CharmDetails panel by showing full-depth references and improving the UI for reference sections. The changes include updating the runner export to include followAliases, refactoring the combined references section in the CharmDetailView, and adding a new test for n-depth reference detection.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| runner/src/index.ts | Added re-export for followAliases to support full-depth reference detection. |
| jumble/src/views/CharmDetailView.tsx | Refactored reference sections by combining "Reading From" and "Read By" into a unified UI and renaming/toggling states. |
| charm/test/charm-references.test.ts | Introduced a test to verify chained reference detection through sourceCell and resultRef. |
Comments suppressed due to low confidence (2)
jumble/src/views/CharmDetailView.tsx:1190
- [nitpick] Consider renaming 'isReferencesExpanded' to a more descriptive state variable that clearly indicates it controls the unified references section, to avoid confusion with the legacy 'Lineage' toggle.
onClick={() => setIsReferencesExpanded(!isReferencesExpanded)}
jumble/src/views/CharmDetailView.tsx:1272
- [nitpick] The use of 'isLineageExpanded' here is inconsistent with the revised combined references approach; consider unifying the toggle logic with 'isReferencesExpanded' to reduce ambiguity in the UI.
onClick={() => setIsLineageExpanded(!isLineageExpanded)}
Fixes #910 #912