Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(core): fix non-reactive tab title on list and channel, fix channel rename (#1299)

Seamusfcba7aefae46
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx
index 8c5131ceb7..4dc5779774 100644
--- a/js/app/packages/app/component/Soup.tsx
+++ b/js/app/packages/app/component/Soup.tsx
@@ -639,6 +639,10 @@ export function Soup() {
const [preview, setPreview] = previewState();
const selectedEntity = () => view().selectedEntity;
+ createEffect(() => {
+ handle.setDisplayName('');
+ });
+
// Sync selected view to split metadata
createEffect(() => {
handle.updateMeta?.({ viewId: selectedView() });
diff --git a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
index 267f16059f..2d36270a2b 100644
--- a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
@@ -59,10 +59,15 @@ export function SplitLabel(props: {
id?: string;
itemType?: ItemType;
}) {
+ const panel = useSplitPanelOrThrow();
const rename = useRenameSplit();
const blockName = useBlockName();
const blockId = useBlockId();
+ createEffect(() => {
+ panel.handle.setDisplayName(props.label);
+ });
+
const startEditing = (e: MouseEvent) => {
if (props.lockRename) return;
if (e.type === 'contextmenu') {
diff --git a/js/app/packages/block-channel/component/Top.tsx b/js/app/packages/block-channel/component/Top.tsx
index 300264b885..6988e4054d 100644
--- a/js/app/packages/block-channel/component/Top.tsx
+++ b/js/app/packages/block-channel/component/Top.tsx
@@ -18,9 +18,11 @@ import LinkIcon from '@icon/regular/link.svg';
import type { ChannelParticipant } from '@service-comms/generated/models/channelParticipant';
import type { ChannelType } from '@service-comms/generated/models/channelType';
import { useUserId } from '@core/context/user';
-import { Show } from 'solid-js';
+import { createMemo, Show } from 'solid-js';
import { AttachmentsModal } from './AttachmentsModal';
import { ParticipantManager } from './ParticipantManager';
+import { useChannelContext } from '@block-channel/hooks/channel';
+import { isChannelAdminOrOwner } from '@queries/channel/derived';
type TopIconProps = {
channelType: ChannelType;
@@ -58,6 +60,12 @@ export function Top(props: TopProps) {
const participantCount = () => props.participants.length;
const blockId = useBlockId();
const notificationSource = useGlobalNotificationSource();
+ const channelContext = useChannelContext();
+
+ const isAdminOrOwner = createMemo(() => {
+ const channelData = channelContext.channel();
+ return isChannelAdminOrOwner(channelData);
+ });
function handleCopyLink() {
navigator.clipboard.writeText(
@@ -89,6 +97,7 @@ export function Top(props: TopProps) {
label={channelName() ?? 'New Channel'}
id={props.channelId}
itemType="channel"
+ lockRename={!isAdminOrOwner()}
/>
</div>
</div>
diff --git a/js/app/packages/service-clients/service-storage/util/refetchResources.ts b/js/app/packages/service-clients/service-storage/util/refetchResources.ts
index f1421bef04..92faaeddc9 100644
--- a/js/app/packages/service-clients/service-storage/util/refetchResources.ts
+++ b/js/app/packages/service-clients/service-storage/util/refetchResources.ts
@@ -4,6 +4,8 @@ import { invalidateProjects } from '@queries/storage/projects';
import { invalidateUserQuota } from '@queries/auth';
import { refetchHistory } from '@queries/history/history';
import { invalidatePreview } from '@queries/preview';
+import { invalidateChannelWithID } from '@queries/channel/channel';
+import { invalidateListChannels } from '@queries/channel/channels';
type RefetchResourcesOptions = {
id?: string;
@@ -19,6 +21,10 @@ export function refetchResources(options?: RefetchResourcesOptions) {
// TODO: consolidate where we rename items
// and optimistically set the data using setPreviewData
invalidatePreview(options?.id);
+ if (options?.id) {
+ invalidateChannelWithID(options.id);
+ invalidateListChannels();
+ }
}
export async function refetchProjectResources(_force = false) {