Merge branch 'dev'

This commit is contained in:
Jeff Emmett 2026-03-04 19:36:17 -08:00
commit 2bb01c5240
3 changed files with 20 additions and 11 deletions

View File

@ -66,8 +66,8 @@ import { dataModule } from "../modules/rdata/mod";
import { splatModule } from "../modules/rsplat/mod";
import { photosModule } from "../modules/rphotos/mod";
import { socialsModule } from "../modules/rsocials/mod";
import { docsModule } from "../modules/rdocs/mod";
import { designModule } from "../modules/rdesign/mod";
// import { docsModule } from "../modules/rdocs/mod";
// import { designModule } from "../modules/rdesign/mod";
import { scheduleModule } from "../modules/rschedule/mod";
import { spaces, createSpace, resolveCallerRole, roleAtLeast } from "./spaces";
import type { SpaceRoleString } from "./spaces";
@ -108,8 +108,8 @@ registerModule(dataModule);
registerModule(splatModule);
registerModule(photosModule);
registerModule(socialsModule);
registerModule(docsModule);
registerModule(designModule);
// registerModule(docsModule); // placeholder — not yet an rApp
// registerModule(designModule); // placeholder — not yet an rApp
registerModule(scheduleModule);
// ── Config ──

View File

@ -333,12 +333,18 @@ export function renderShell(opts: ShellOptions): string {
} catch(e) { tabCache = null; }
// ── Tab events ──
// Set active on tab bar ONLY after switchTo() confirms the pane is ready.
// This prevents the visual desync where the tab highlights before content loads.
tabBar.addEventListener('layer-switch', (e) => {
const { moduleId } = e.detail;
const { layerId, moduleId } = e.detail;
saveTabs();
if (tabCache) {
tabCache.switchTo(moduleId).then(ok => {
if (!ok) window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId);
if (ok) {
tabBar.setAttribute('active', layerId);
} else {
window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId);
}
});
} else {
window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId);
@ -353,7 +359,11 @@ export function renderShell(opts: ShellOptions): string {
saveTabs();
if (tabCache) {
tabCache.switchTo(moduleId).then(ok => {
if (!ok) window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId);
if (ok) {
tabBar.setAttribute('active', 'layer-' + moduleId);
} else {
window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId);
}
});
} else {
window.location.href = window.__rspaceNavUrl(spaceSlug, moduleId);

View File

@ -794,14 +794,14 @@ export class RStackTabBar extends HTMLElement {
// Clean up previous document-level listeners to prevent leak
if (this.#docCleanup) { this.#docCleanup(); this.#docCleanup = null; }
// Tab clicks
// Tab clicks — dispatch event but do NOT set active yet.
// The shell's event handler calls switchTo() and sets active only after success.
this.#shadow.querySelectorAll<HTMLElement>(".tab").forEach(tab => {
tab.addEventListener("click", (e) => {
const target = e.target as HTMLElement;
if (target.classList.contains("tab-close")) return;
const layerId = tab.dataset.layerId!;
const moduleId = tab.dataset.moduleId!;
this.active = layerId;
this.trackRecent(moduleId);
this.dispatchEvent(new CustomEvent("layer-switch", {
detail: { layerId, moduleId },
@ -929,12 +929,11 @@ export class RStackTabBar extends HTMLElement {
this.#shadow.querySelectorAll<HTMLElement>(".layer-plane").forEach(plane => {
const layerId = plane.dataset.layerId!;
// Click to switch layer
// Click to switch layer — do NOT set active here, let shell handler confirm
plane.addEventListener("click", (e) => {
if (this.#flowDragSource || this.#orbitDragging) return;
const layer = this.#layers.find(l => l.id === layerId);
if (layer) {
this.active = layerId;
this.dispatchEvent(new CustomEvent("layer-switch", {
detail: { layerId, moduleId: layer.moduleId },
bubbles: true,