diff --git a/.changeset/young-singers-learn.md b/.changeset/young-singers-learn.md
new file mode 100644
index 0000000000..9df5d91fe3
--- /dev/null
+++ b/.changeset/young-singers-learn.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-splunk-on-call': patch
+---
+
+Refactor plugin Card component to not rerender contents unnecessarily.
diff --git a/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx b/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx
index 26521ea9ee..0f32c925f0 100644
--- a/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx
+++ b/plugins/splunk-on-call/src/components/EntitySplunkOnCallCard.tsx
@@ -99,6 +99,48 @@ export const MissingEventsRestEndpoint = () => (
);
+const Content = ({
+ team,
+ routingKey,
+ usersHashMap,
+ readOnly,
+ showDialog,
+ refreshIncidents,
+ actions,
+}: {
+ team: Team | undefined;
+ routingKey: RoutingKey | undefined;
+ usersHashMap: any;
+ readOnly: boolean;
+ showDialog: boolean;
+ refreshIncidents: boolean;
+ actions: {
+ handleDialog: () => void;
+ handleRefresh: () => void;
+ };
+}) => {
+ const teamName = team?.name ?? '';
+
+ return (
+ <>
+
+ {usersHashMap && team && (
+
+ )}
+
+ >
+ );
+};
+
/** @public */
export const isSplunkOnCallAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_TEAM]) ||
@@ -219,37 +261,6 @@ export const EntitySplunkOnCallCard = (props: EntitySplunkOnCallCardProps) => {
);
}
- const Content = ({
- team,
- routingKey,
- usersHashMap,
- }: {
- team: Team | undefined;
- routingKey: RoutingKey | undefined;
- usersHashMap: any;
- }) => {
- const teamName = team?.name ?? '';
-
- return (
- <>
-
- {usersHashMap && team && (
-
- )}
-
- >
- );
- };
-
const triggerLink: IconLinkVerticalProps = {
label: 'Create Incident',
onClick: handleDialog,
@@ -287,6 +298,13 @@ export const EntitySplunkOnCallCard = (props: EntitySplunkOnCallCardProps) => {
team={team}
routingKey={entityData?.foundRoutingKey}
usersHashMap={entityData?.usersHashMap}
+ readOnly={readOnly ?? false}
+ refreshIncidents={refreshIncidents}
+ showDialog={showDialog}
+ actions={{
+ handleRefresh,
+ handleDialog,
+ }}
/>