fix(favicon): populate stacked title bar favicons from cache on stack creation
When panes are converted from splits to stacks, new title bars are created with default icons. The cached favicon textures were never applied to these newly-created title bars because resolveCommittedFavicon had already run (during the original page load) before the stack existed. Now populates favicons from the texture cache immediately after stacked view callbacks are set up, using each pane's current WebView URI.
- commit
- b0dae66947f4b399f6bcd39335ccf406d3b991f3
- author
- brice · · 2026-03-13 06:02 UTC
- parent
- 929f98f
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +30 -0
M internal/ui/coordinator/workspace.go +30 -0
| @@ -1713,6 +1713,36 @@ func (c *WorkspaceCoordinator) SetupStackedPaneCallbacks(ctx context.Context, ws | |||
| 1713 | 1713 | c.onStackedPaneClose(ctx, entity.PaneID(paneID)) | |
| 1714 | 1714 | }) | |
| 1715 | 1715 | ||
| 1716 | + | // Populate stacked title bar favicons from cache. | |
| 1717 | + | // When panes are stacked (split → stack conversion) or restored from session, | |
| 1718 | + | // the title bars are created with default icons. We need to apply any cached | |
| 1719 | + | // favicon textures so they display correctly without waiting for a new navigation. | |
| 1720 | + | if fa := c.contentCoord.FaviconAdapter(); fa != nil { | |
| 1721 | + | for i, child := range node.Children { | |
| 1722 | + | if child.Pane == nil { | |
| 1723 | + | continue | |
| 1724 | + | } | |
| 1725 | + | // Try to get the pane's current URI from its WebView | |
| 1726 | + | uri := child.Pane.URI | |
| 1727 | + | if wv := c.contentCoord.GetWebView(child.Pane.ID); wv != nil { | |
| 1728 | + | if currentURI := wv.URI(); currentURI != "" { | |
| 1729 | + | uri = currentURI | |
| 1730 | + | } | |
| 1731 | + | } | |
| 1732 | + | if uri == "" { | |
| 1733 | + | continue | |
| 1734 | + | } | |
| 1735 | + | if texture := fa.GetTextureByURL(uri); texture != nil { | |
| 1736 | + | if err := stackedView.UpdateFaviconTexture(i, texture); err == nil { | |
| 1737 | + | log.Debug(). | |
| 1738 | + | Str("pane_id", string(child.Pane.ID)). | |
| 1739 | + | Str("domain", domainurl.ExtractDomain(uri)). | |
| 1740 | + | Msg("populated stacked title bar favicon from cache") | |
| 1741 | + | } | |
| 1742 | + | } | |
| 1743 | + | } | |
| 1744 | + | } | |
| 1745 | + | ||
| 1716 | 1746 | log.Debug(). | |
| 1717 | 1747 | Str("stack_id", node.ID). | |
| 1718 | 1748 | Int("stack_size", len(node.Children)). | |
| @@ -1713,6 +1713,36 @@ func (c *WorkspaceCoordinator) SetupStackedPaneCallbacks(ctx context.Context, ws | |||||
| 1713 | c.onStackedPaneClose(ctx, entity.PaneID(paneID)) | 1713 | c.onStackedPaneClose(ctx, entity.PaneID(paneID)) | ||
| 1714 | }) | 1714 | }) | ||
| 1715 | 1715 | ||||
| 1716 | + | // Populate stacked title bar favicons from cache. | |||
| 1717 | + | // When panes are stacked (split → stack conversion) or restored from session, | |||
| 1718 | + | // the title bars are created with default icons. We need to apply any cached | |||
| 1719 | + | // favicon textures so they display correctly without waiting for a new navigation. | |||
| 1720 | + | if fa := c.contentCoord.FaviconAdapter(); fa != nil { | |||
| 1721 | + | for i, child := range node.Children { | |||
| 1722 | + | if child.Pane == nil { | |||
| 1723 | + | continue | |||
| 1724 | + | } | |||
| 1725 | + | // Try to get the pane's current URI from its WebView | |||
| 1726 | + | uri := child.Pane.URI | |||
| 1727 | + | if wv := c.contentCoord.GetWebView(child.Pane.ID); wv != nil { | |||
| 1728 | + | if currentURI := wv.URI(); currentURI != "" { | |||
| 1729 | + | uri = currentURI | |||
| 1730 | + | } | |||
| 1731 | + | } | |||
| 1732 | + | if uri == "" { | |||
| 1733 | + | continue | |||
| 1734 | + | } | |||
| 1735 | + | if texture := fa.GetTextureByURL(uri); texture != nil { | |||
| 1736 | + | if err := stackedView.UpdateFaviconTexture(i, texture); err == nil { | |||
| 1737 | + | log.Debug(). | |||
| 1738 | + | Str("pane_id", string(child.Pane.ID)). | |||
| 1739 | + | Str("domain", domainurl.ExtractDomain(uri)). | |||
| 1740 | + | Msg("populated stacked title bar favicon from cache") | |||
| 1741 | + | } | |||
| 1742 | + | } | |||
| 1743 | + | } | |||
| 1744 | + | } | |||
| 1745 | + | ||||
| 1716 | log.Debug(). | 1746 | log.Debug(). | ||
| 1717 | Str("stack_id", node.ID). | 1747 | Str("stack_id", node.ID). | ||
| 1718 | Int("stack_size", len(node.Children)). | 1748 | Int("stack_size", len(node.Children)). | ||