Skip to content

fix(google-docs): create entries button resumes workflow [INTEG-3791]#10884

Merged
Harika Kondur (harikakondur) merged 9 commits intomasterfrom
gdocs/create-entries
Apr 16, 2026
Merged

fix(google-docs): create entries button resumes workflow [INTEG-3791]#10884
Harika Kondur (harikakondur) merged 9 commits intomasterfrom
gdocs/create-entries

Conversation

@harikakondur
Copy link
Copy Markdown
Contributor

Summary

  • Replaces temporary OverviewPanel component in the mapping review page with a refactored OverviewSection component that reads directly from MappingReviewSuspendPayload.entryBlockGraph instead of filler mock data
  • Adds a "Create entries" CTA that resumes the workflow, polls until completion, creates entries in Contentful via CMA, and displays a SummaryModal with the results
  • Entry list now supports parent-child nesting using referenceGraph.edges and renders with tree lines
  • Updates OverviewSection UI with "How to use this app" header, lightbulb icon, and divider
  • Renames overview/ and utils/ files to remove stale CheckboxEntryList/OverviewSection naming (EntryList, Overview, entryList.ts)
  • Cleanup PreviewPayload type

Updated Overview Section
Screenshot 2026-04-16 at 2 46 37 PM

Mappings are Visible Based on Selected Entry
https://github.com/user-attachments/assets/c371ad60-d645-4540-a6cb-1fa8e6d7db3f

Copilot AI review requested due to automatic review settings April 16, 2026 20:53
@harikakondur Harika Kondur (harikakondur) changed the title fix(google-docs): create entries button resumes workflow fix(google-docs): create entries button resumes workflow [INTEG-3791] Apr 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Google Docs mapping review experience by replacing the temporary overview UI with a refactored OverviewSection that reads from MappingReviewSuspendPayload.entryBlockGraph, adds a “Create entries” CTA that resumes the workflow and then creates entries in Contentful, and introduces a nested entry list UI.

Changes:

  • Replace OverviewPanel/mock overview data with OverviewSection backed by entryBlockGraph + referenceGraph.edges.
  • Add “Create entries” workflow resume + entry creation flow with SummaryModal.
  • Rename/refactor entry list utilities and remove PreviewPayload.normalizedDocument.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
apps/google-docs/test/utils/entryList.test.ts Updates tests for renamed entry list utilities and updated PreviewPayload shape.
apps/google-docs/src/utils/previewPayload.ts Stops parsing/returning normalizedDocument from validated preview payloads.
apps/google-docs/src/utils/entryList.ts Renames list row types and adds buildEntryListFromEntryBlockGraph for nested UI rendering.
apps/google-docs/src/types/workflow.ts Simplifies PreviewPayload by removing normalizedDocument (and unused fields).
apps/google-docs/src/services/entryService.ts Removes selected-entry filtering when creating entries from a preview payload.
apps/google-docs/src/locations/Page/components/review/ReviewPage.tsx Wires in new OverviewSection and selection state for mapping focus.
apps/google-docs/src/locations/Page/components/overview/OverviewSection.tsx Implements new overview UI + “Create entries” action and summary modal.
apps/google-docs/src/locations/Page/components/overview/OverviewSection.styles.ts Adjusts scroll container sizing/overflow behavior.
apps/google-docs/src/locations/Page/components/overview/EntryList.tsx Adds new selectable (non-checkbox) entry list UI with tree rendering.
apps/google-docs/src/locations/Page/components/overview/EntryList.styles.ts Adds tree-line styling for nested entries.
apps/google-docs/src/locations/Page/components/modals/SummaryModal.tsx Updates to use entryList types instead of the removed checkbox list types.
apps/google-docs/src/locations/Page/Page.tsx Adds workflow “resume to create entries” handler and passes it to ReviewPage.
apps/google-docs/src/hooks/useWorkflowAgent.ts Updates the “cancelled run” preview payload shape to match the new PreviewPayload type.
(deleted) apps/google-docs/src/locations/Page/components/review/overview/buildOverviewEntries.ts Removes temporary overview entry builder (mock-based).
(deleted) apps/google-docs/src/locations/Page/components/review/overview/OverviewPanel.tsx Removes temporary overview panel UI.
(deleted) apps/google-docs/src/locations/Page/components/overview/CheckboxEntryList.tsx Removes checkbox-based entry selection UI.
Comments suppressed due to low confidence (3)

apps/google-docs/src/utils/entryList.ts:270

  • buildEntryListFromEntryBlockGraph determines roots by excluding everything that was ever assigned as a child. With circular dependencies (note referenceGraph.hasCircularDependency exists) this can exclude all entries, causing the overview to render an empty list even when entries is non-empty. Add cycle/visited handling and/or a fallback: if no roots are found, render a flat list (similar to buildEntryList) so entries are still visible.
    apps/google-docs/src/utils/entryList.ts:271
  • buildEntryListFromEntryBlockGraph is newly introduced behavior (tree-building from referenceGraph.edges) but there are no corresponding unit tests alongside the existing buildEntryList tests. Adding tests for roots/children construction, missing content type names, and circular edge fallback will help prevent regressions as the workflow payload evolves.
    apps/google-docs/src/utils/entryList.ts:231
  • contentTypeNameById stores ct.name ?? '', which can yield an empty string when the backend doesn’t provide a name. That ends up rendering as “Untitled” in the UI even though a stable fallback (like ct.sys.id) exists. Consider storing ct.name ?? ct.sys.id (and/or treating blank names as missing) so rows always have a meaningful content type label.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}: ReviewPageProps) => {
const [isConfirmCancelModalOpen, setIsConfirmCancelModalOpen] = useState(false);
const [selectedEntryIndex, setSelectedEntryIndex] = useState<number | null>(null);
const [selectedEntryIndex, setSelectedEntryIndex] = useState<number>(0);
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

selectedEntryIndex is now always a number (initialized to 0) and there’s no longer a way to set it to null, but MappingView still uses null to mean “show all mappings”. This effectively removes the “All mappings” mode and will hide mappings for other entries by default. Consider restoring a nullable state (or an explicit “All mappings” selection) so users can return to the unfiltered view.

Suggested change
const [selectedEntryIndex, setSelectedEntryIndex] = useState<number>(0);
const [selectedEntryIndex, setSelectedEntryIndex] = useState<number | null>(null);

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +56
<Card
padding="default"
as="button"
type="button"
onClick={() => {
if (!isSelected) onSelect(row.entryIndex);
}}
style={{
border: `2px solid ${isSelected ? tokens.blue500 : tokens.gray300}`,
backgroundColor: tokens.colorWhite,
cursor: isSelected ? 'default' : 'pointer',
textAlign: 'left',
width: '100%',
}}>
<Paragraph marginBottom="none">
<Text as="span" fontWeight="fontWeightDemiBold">
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The entry cards are used as a single-select control, but the button doesn’t expose its selected state to assistive tech (no aria-pressed/aria-selected) and there’s no accessible name beyond the visible text. Add an ARIA selection attribute (and consider a role="button"/role="option" pattern with aria-selected) so screen readers can understand which entry is currently active.

Copilot uses AI. Check for mistakes.
Comment thread apps/google-docs/src/services/entryService.ts
Comment on lines +66 to +67
const result = await createEntriesFromPreviewPayload(sdk, previewPayload);

Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

createEntriesFromPreviewPayload supports an oauthToken argument that switches asset creation into a safer “fetch then upload” mode to avoid Contentful fetching expiring signed URLs. The new call site doesn’t pass the token anymore, which can regress asset reliability for Google-hosted images. Thread the existing oauthToken state down (or pass a boolean/flag) so entry/asset creation preserves the intended behavior.

Suggested change
const result = await createEntriesFromPreviewPayload(sdk, previewPayload);
const oauthToken =
typeof (previewPayload as Record<string, unknown>).oauthToken === 'string'
? ((previewPayload as Record<string, unknown>).oauthToken as string)
: typeof (payload as Record<string, unknown>).oauthToken === 'string'
? ((payload as Record<string, unknown>).oauthToken as string)
: undefined;
const result = await createEntriesFromPreviewPayload(sdk, previewPayload, oauthToken);

Copilot uses AI. Check for mistakes.
Comment thread apps/google-docs/src/utils/createEntries.ts
Comment on lines +56 to 71
const handleCreateEntries = async () => {
console.log('[create-entries] creating entries, calling onCreateEntries');
setIsCreating(true);

try {
await onCreateSelected();
const previewPayload = await onCreateEntries();

if (!previewPayload) {
return;
}
const result = await createEntriesFromPreviewPayload(sdk, previewPayload);

setSummaryEntries(result.createdEntries);
} catch (error) {
} finally {
setIsCreating(false);
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

handleCreateEntries currently logs to the console and silently swallows any thrown error (empty catch). This makes failures (workflow resume, entry creation, CMA errors) hard to diagnose and provides no user feedback. Remove the debug console.log and surface errors (at minimum log with context; ideally show an F36 Notification / Note state).

Copilot uses AI. Check for mistakes.
@harikakondur Harika Kondur (harikakondur) merged commit 21ed6f8 into master Apr 16, 2026
17 checks passed
@harikakondur Harika Kondur (harikakondur) deleted the gdocs/create-entries branch April 16, 2026 22:11
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.

3 participants