Skip to content

refactor: remove BlockAssemblyDetails and improve UI components#8

Merged
oskarszoon merged 6 commits into
bsv-blockchain:mainfrom
ordishs:fix/remove-subtrees-from-nodeStatus
Oct 16, 2025
Merged

refactor: remove BlockAssemblyDetails and improve UI components#8
oskarszoon merged 6 commits into
bsv-blockchain:mainfrom
ordishs:fix/remove-subtrees-from-nodeStatus

Conversation

@ordishs

@ordishs ordishs commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Remove BlockAssemblyDetails from P2P node status notifications (fixes typecheck errors)
  • Add clear sort button to network table
  • Fix current node positioning in network table when sorting is active
  • Hide ancestors link from sidebar navigation (page remains accessible)
  • Add tooltip and copy functionality to invalidated blocks hash column in admin page

Backend Changes

  • services/p2p/Server.go: Removed BlockAssemblyDetails field from node status notifications and removed unused code
  • services/p2p/HandleWebsocket.go: Updated notification message handling

UI Changes

  • Network table: Added icon-only clear sort button that appears when sorting is active
  • Network table: Fixed logic to only place current node at top when no user sorting is applied
  • Sidebar: Commented out ancestors link while keeping the page accessible via direct URL
  • Admin page: Replaced custom hash rendering with reusable RenderHashWithMiner component for consistent tooltip and copy functionality

Test plan

  • Verify typecheck passes (make lint)
  • Verify network table displays current node at top by default
  • Verify clear sort button appears when sorting and removes sorting when clicked
  • Verify ancestors page is still accessible at /ancestors but not in sidebar
  • Verify hash column in admin invalidated blocks table shows tooltip and copy button
  • Verify hash is clickable and links to block viewer

ordishs and others added 6 commits October 15, 2025 16:29
…ions

Replace detailed block assembly state with simpler subtree_count field
in websocket notifications to reduce message size and coupling
Add icon button to clear sorting on network nodes table and ensure
current node appears at top only when no user sorting is active
Keep ancestors page accessible via direct URL but remove from menu
Replace custom hash rendering with reusable RenderHashWithMiner component
to provide consistent tooltip display and copy-to-clipboard functionality
across the admin page's recently invalidated blocks table.
…l pointer panic

Remove BlockAssemblyDetails field from NodeStatusMessage struct and eliminate
attempts to access SubtreeCount/TxCount fields that caused segmentation fault
in handleNodeStatusTopic. Also remove unused blockassembly_api import.
@oskarszoon

Copy link
Copy Markdown
Contributor

/claude-review

@claude

claude Bot commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Claude finished @oskarszoon's task —— View job


Code Review Complete ✅

Summary

This PR successfully removes the BlockAssemblyDetails field from P2P node status notifications and adds several UI improvements to the network table and admin page. The changes are clean, well-structured, and improve code maintainability by removing unused functionality and consolidating UI components.

Backend Changes ✅

services/p2p/Server.go & HandleWebsocket.go

  • ✅ Cleanly removed BlockAssemblyDetails field from NodeStatusMessage struct and notificationMsg struct
  • ✅ Removed unused import blockassembly/blockassembly_api
  • ✅ Removed code that fetched block assembly state in getNodeStatusMessage()
  • ✅ Updated all struct instantiation sites consistently
  • ✅ Replaced removed field with existing SubtreeCount field in notificationMsg (line 41 in HandleWebsocket.go)
  • ✅ No breaking changes to JSON API since field had omitempty tag
  • ✅ Code formatting and alignment improved

UI Changes ✅

Network Table (connected-nodes-card/index.svelte & network/+page.svelte)

  • ✅ Added clear sort button that appears conditionally when sorting is active
  • ✅ Button has proper hover/active states and accessibility (title attribute)
  • ✅ Fixed logic to only position current node at top when no user sorting is applied (lines 253-256 in network/+page.svelte)
  • ✅ Properly clears sort from localStorage when sort is cleared
  • ✅ Good conditional rendering: {#if hasSorting}

Admin Page (admin/+page.svelte)

  • ✅ Replaced custom hash rendering with reusable RenderHashWithMiner component
  • ✅ Removed duplicate .copy-button CSS styles (cleaned up ~65 lines)
  • ✅ Component usage is correct with proper props:
    • hash, hashUrl, shortHash, showCopyButton, copyTooltip, tooltip
  • ✅ Maintains same functionality (tooltip, copy, clickable link to block viewer)

Layout (+layout.svelte)

  • ✅ Properly commented out ancestors navigation link
  • ✅ Page remains accessible via direct URL as stated in PR description

Observations

Code Quality

  • Clean refactoring with no apparent logic errors
  • Consistent formatting and alignment
  • Good component reusability (RenderHashWithMiner)
  • Proper conditional rendering and state management

Potential Considerations (not blocking)

  1. The SubtreeCount field added to notificationMsg struct (line 41 in HandleWebsocket.go) is not populated anywhere in the code I reviewed - it may need to be set in getNodeStatusMessage() if it's intended to be used
  2. Consider adding a comment explaining why ancestors link is commented out rather than removed (for future maintainers)

Test Plan Coverage

The test plan covers all the changes appropriately:

  • ✅ Typecheck verification
  • ✅ Network table current node positioning
  • ✅ Clear sort button functionality
  • ✅ Ancestors page accessibility
  • ✅ Admin page hash column functionality

⚠️ Reminder: Since this is a fork PR, I cannot run make lint or tests. Please ensure these pass in CI before merging.

Recommendation

Approve ✅ - The changes are well-implemented, maintain backward compatibility (thanks to omitempty), and improve code quality through better component reuse. The logic fixes for the network table are correct.


⚠️ Note: This is a fork PR - review based on static code analysis only. Cannot execute code or run tests for security reasons.

Branch: fix/remove-subtrees-from-nodeStatus

@oskarszoon oskarszoon merged commit 00331b5 into bsv-blockchain:main Oct 16, 2025
5 checks passed
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.

2 participants