Skip to content

Commit 28e0380

Browse files
namedgraphclaude
andcommitted
Sync reused-pane tab metadata and fix address-bar local check
When ldh:rdf-document-response reuses a same-origin tab pane for a new URI, also update the matching tab <li>'s data-uri, <a href>, title, and label. Downstream lookups in ldh:RenderTab and ldh:DocumentNavigate key on data-uri, so a stale data-uri silently mismatched and left the tab showing the previous URI. Switch the address-bar "is local?" check in ldh:DocumentNavigate from ldt:base() to lapp:origin(ldh:request-uri()) || '/'. ldt:base() reads the active pane's data-base, which mis-classified URIs while a proxy pane was still active: same-origin proxy URLs got the bar cleared, and switching back to a local doc left the bar populated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f726423 commit 28e0380

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

  • src/main/webapp/static/com/atomgraph/linkeddatahub/xsl

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client.xsl

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ WHERE
518518
<xsl:choose>
519519
<!-- pane exists: replace document-body content, leave sidebar intact -->
520520
<xsl:when test="$reuse-pane">
521+
<xsl:variable name="old-about" select="string($reuse-pane/div[contains-token(@class, 'document-body')]/@about)" as="xs:string"/>
522+
521523
<xsl:for-each select="$reuse-pane/div[contains-token(@class, 'document-body')]">
522524
<xsl:result-document href="?." method="ixsl:replace-element">
523525
<xsl:apply-templates select="$results/rdf:RDF" mode="bs2:DocumentBody">
@@ -530,6 +532,20 @@ WHERE
530532
<!-- update @about to new URI -->
531533
<ixsl:set-attribute name="about" select="$uri" object="."/>
532534
</xsl:for-each>
535+
536+
<!-- sync the corresponding tab <li> to the new URI: data-uri keys downstream tab-activation and href-sync lookups -->
537+
<xsl:if test="string($uri) ne $old-about">
538+
<xsl:for-each select="id('tab-bar-list', ixsl:page())/li[ixsl:get(., 'dataset.uri') = $old-about]">
539+
<ixsl:set-attribute name="data-uri" select="string($uri)" object="."/>
540+
<xsl:for-each select="a">
541+
<ixsl:set-attribute name="href" select="string(ldh:href($uri, ldh:build-query($mode)))" object="."/>
542+
<ixsl:set-attribute name="title" select="string($uri)" object="."/>
543+
<xsl:result-document href="?." method="ixsl:replace-content">
544+
<xsl:value-of select="$label"/>
545+
</xsl:result-document>
546+
</xsl:for-each>
547+
</xsl:for-each>
548+
</xsl:if>
533549
</xsl:when>
534550
<!-- no pane: create one with sidebar -->
535551
<xsl:otherwise>
@@ -802,9 +818,10 @@ WHERE
802818
<xsl:variable name="href" select="ldh:href($uri, $query-params)" as="xs:anyURI"/>
803819

804820
<!-- update address bar input: show external URI, clear for local docs -->
821+
<!-- use browser origin (not ldt:base()) so the check is correct even when an external tab is active: ldt:base() reads the active pane's data-base, which would mis-classify same-origin proxy URIs as "local" and cross-dataspace URIs as "external" mid-switch -->
805822
<xsl:for-each select="id('uri', ixsl:page())">
806823
<xsl:choose>
807-
<xsl:when test="not(starts-with($uri, ldt:base()))">
824+
<xsl:when test="not(starts-with($uri, lapp:origin(ldh:request-uri()) || '/'))">
808825
<ixsl:set-property name="value" select="string($uri)" object="."/>
809826
</xsl:when>
810827
<xsl:otherwise>
@@ -813,7 +830,7 @@ WHERE
813830
</xsl:choose>
814831
</xsl:for-each>
815832

816-
<!-- hide local tab pane for external URIs; use browser origin (not ldt:base()) so the check is correct even when an external tab is active -->
833+
<!-- hide local tab pane for external URIs -->
817834
<xsl:if test="not(starts-with($uri, lapp:origin(ldh:request-uri()) || '/'))">
818835
<xsl:for-each select="id('tab-content', ixsl:page())/div[contains-token(@class, 'tab-pane')][./div[contains-token(@class, 'document-body')]/@about = ac:absolute-path(ldh:request-uri())]">
819836
<ixsl:set-style name="display" select="'none'" object="."/>

0 commit comments

Comments
 (0)