Skip to content

align portals and shortcuts views with snippets/clipboard-history layout#313

Merged
Xoshbin merged 1 commit into
mainfrom
portals-shortcuts-redesign
May 8, 2026
Merged

align portals and shortcuts views with snippets/clipboard-history layout#313
Xoshbin merged 1 commit into
mainfrom
portals-shortcuts-redesign

Conversation

@Xoshbin

@Xoshbin Xoshbin commented May 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Portals and Shortcuts views to use a standardized SplitListDetail layout, improving UI consistency and functionality. Key enhancements include the introduction of shortcut grouping, URL placeholder parsing for portals, and improved error handling via the diagnosticsService. Review feedback suggests minor optimizations, such as removing redundant object spreading and await tick() calls, and consistently using derived state variables instead of direct store access.

const editingId = editingPortal.id;
portalStore.update(editingId, portal);
await removePortalFromIndex(editingId);
await syncPortalToIndex({ ...portal, id: editingId });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The spread operation { ...portal, id: editingId } is redundant here. Since portal is the object returned by the form and editingId was passed into it, portal.id is already guaranteed to be equal to editingId. You can pass portal directly to syncPortalToIndex.

        await syncPortalToIndex(portal);

} else {
portalStore.add(portal);
await syncPortalToIndex(portal);
const idx = portalStore.portals.findIndex(p => p.id === portal.id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is recommended to use the derived portals variable instead of accessing portalStore.portals directly for consistency with the rest of the component's logic.

        const idx = portals.findIndex(p => p.id === portal.id);

context: { message: `Could not index duplicated portal: ${err}` },
});
}
await tick();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The await tick() call is redundant. Since syncPortalToIndex is an asynchronous operation that has already been awaited, the microtask queue has been processed and the reactive state in portalStore (which is updated synchronously in add()) is already available for the subsequent findIndex call.

});
}
await tick();
const idx = portalStore.portals.findIndex(p => p.id === dup.id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and to leverage the reactive derivation, use the local portals variable instead of portalStore.portals directly.

    const idx = portals.findIndex(p => p.id === dup.id);

@Xoshbin Xoshbin merged commit ec305e6 into main May 8, 2026
1 check passed
@Xoshbin Xoshbin deleted the portals-shortcuts-redesign branch May 8, 2026 07:12
Xoshbin added a commit that referenced this pull request May 24, 2026
align portals and shortcuts views with snippets/clipboard-history layout
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.

1 participant