Conversation
Add support for indexing Saleor Pages to Algolia, following the same patterns established for categories. Pages are indexed to a dedicated "pages" index with configurable fields (content, seoDescription, metadata, attributes) and always-indexed fields (title, slug, pageTypeId, seoTitle). - Add PageData GraphQL fragment, subscriptions (created/updated/deleted), and bulk import query - Add pageToAlgolia() and pageToAlgoliaIndexId() utilities - Extend SearchProvider interface and AlgoliaSearchProvider with page CRUD methods, batch import, and index settings - Add PAGE_CREATED/UPDATED/DELETED webhook definitions and handlers - Add page fields configuration (schema, router mutation, UI form) - Add page bulk import support alongside products and categories - Pass pageEnabledKeys through webhook context, search provider, and setup-indices Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use PageFilterInput type from generated GraphQL for the filter variable - Replace dynamic import with static import for PageTypesDataDocument - Rename page webhook files from underscores to dashes (page_created -> page-created) - Update webhookPath in definitions to match renamed files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
7 Skipped Deployments
|
🦋 Changeset detectedLatest commit: def3de8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
This PR adds Algolia indexing support for Saleor pages in the search app, mirroring the existing patterns for products and categories.
Changes:
- Adds page CRUD webhook handlers (page-created, page-updated, page-deleted) with page type filtering
- Adds configuration UI for page fields selection and page type filtering
- Extends the Algolia search provider and batch import to support pages
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
apps/search/webhooks.ts |
Registers new page webhook definitions |
apps/search/src/webhooks/definitions/page-*.ts |
New webhook definitions for page events |
apps/search/src/pages/api/webhooks/saleor/page-*.ts |
Webhook handlers for page CRUD events |
apps/search/src/lib/algolia/algoliaSearchProvider.ts |
Adds page CRUD and batch methods to Algolia provider |
apps/search/src/lib/algolia/pageAlgoliaUtils.ts |
Page-to-Algolia object transformation |
apps/search/src/lib/algolia-fields.ts |
Page field definitions and labels |
apps/search/src/lib/searchProvider.ts |
Extends SearchProvider interface with page methods |
apps/search/src/lib/webhook-event-types.ts |
Page webhook event type definitions |
apps/search/src/modules/configuration/configuration.ts |
Schema and AppConfig extensions for page settings |
apps/search/src/modules/configuration/configuration.router.ts |
tRPC routes for page config and page types |
apps/search/src/components/AlgoliaPageFieldsSelectionForm.tsx |
UI for page fields selection |
apps/search/src/components/PageTypesFilterForm.tsx |
UI for page type filtering |
apps/search/src/components/ImportProductsToAlgolia/* |
Extended batch import to include pages |
apps/search/src/views/configuration/configuration.view.tsx |
Adds page config sections to UI |
apps/search/src/webhooks/webhook-context.ts |
Passes page enabled keys to search provider |
apps/search/src/pages/api/setup-indices.ts |
Passes page enabled keys during index setup |
apps/search/graphql/** |
GraphQL fragments, queries, and subscriptions for pages |
apps/search/generated/graphql.ts |
Auto-generated GraphQL types |
apps/search/src/lib/algolia/algoliaUtils.ts |
Exports mapSelectedAttributesToRecord for reuse |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2282 +/- ##
==========================================
- Coverage 37.31% 37.03% -0.29%
==========================================
Files 996 1015 +19
Lines 65115 65870 +755
Branches 3359 3384 +25
==========================================
+ Hits 24299 24395 +96
- Misses 40447 41096 +649
- Partials 369 379 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Show a placeholder in ImportPagesToAlgolia when no page types are selected, and ensure the component re-renders when the filter is updated — without requiring a page refresh. Lift the getConfig query to ConfigurationView so both PageTypesFilterForm and ImportPagesToAlgolia share state through props rather than relying on cross-component tRPC cache invalidation which doesn't work reliably with the dual QueryClient setup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pages are only stored as plain text, so the JSON content field is unnecessary. Removes "content" from AlgoliaPageFields and the corresponding indexing logic in pageToAlgolia. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract the monolithic useBatchUpload.ts into focused single-responsibility files: - useUploadState.ts: upload state management hook and UploadState type - useGraphQLClient.ts: paginated GraphQL fetching (products, categories, pages) - runBatchedUpload.ts: batched async upload utility - useProductsBatchUpload.ts, useCategoriesBatchUpload.ts, usePagesBatchUpload.ts: individual batch upload hooks useBatchUpload.ts remains as a re-export barrel for backward compatibility. Consumers updated to import directly from the specific modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Saleor Pages indexing support to the Search app’s Algolia integration, including new page webhooks, page index mapping/settings, and configuration UI for page-specific field selection and page-type filtering.
Changes:
- Add PAGE_CREATED / PAGE_UPDATED / PAGE_DELETED webhooks and handlers that sync Pages to a dedicated Algolia “pages” index.
- Extend Algolia provider + config to support page field mapping (
pageEnabledKeys) and page-type filtering. - Expand the configuration UI with page-type selection, page field selection, and separate “initial import” actions for products, categories, and pages.
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/search/webhooks.ts | Registers new page webhook definitions in the app’s webhook list. |
| apps/search/src/webhooks/webhook-context.ts | Passes page field mapping (pageEnabledKeys) into Algolia provider during webhook handling. |
| apps/search/src/webhooks/definitions/page-created.ts | Defines PAGE_CREATED webhook (currently uses kebab-case route path). |
| apps/search/src/webhooks/definitions/page-updated.ts | Defines PAGE_UPDATED webhook (currently uses kebab-case route path). |
| apps/search/src/webhooks/definitions/page-deleted.ts | Defines PAGE_DELETED webhook (currently uses kebab-case route path). |
| apps/search/src/pages/api/webhooks/saleor/page-created.ts | New API handler to index created pages into Algolia with error handling. |
| apps/search/src/pages/api/webhooks/saleor/page-updated.ts | New API handler to update pages in Algolia with error handling. |
| apps/search/src/pages/api/webhooks/saleor/page-deleted.ts | New API handler to remove pages from Algolia with error handling. |
| apps/search/src/pages/api/setup-indices.ts | Extends index setup to include page field mapping defaults. |
| apps/search/src/modules/configuration/configuration.ts | Adds page fields mapping + page type filter storage to metadata-backed config. |
| apps/search/src/modules/configuration/configuration.router.ts | Adds tRPC endpoints for page fields mapping, page types fetching, and page-type filter persistence. |
| apps/search/src/views/configuration/configuration.view.tsx | Adds UI sections for page types filter, page field filtering, and page import; expands import UI. |
| apps/search/src/lib/webhook-event-types.ts | Adds typed payload aliases for page subscription events. |
| apps/search/src/lib/searchProvider.ts | Extends provider contract with create/update/delete Page operations. |
| apps/search/src/lib/algolia/pageAlgoliaUtils.ts | Adds page-to-Algolia record mapping and “pages” index naming helper. |
| apps/search/src/lib/algolia/algoliaUtils.ts | Exports mapSelectedAttributesToRecord for reuse in page mapping. |
| apps/search/src/lib/algolia/algoliaSearchProvider.ts | Adds pages index name, page CRUD operations, batch page upload, and page index settings. |
| apps/search/src/lib/algolia-fields.ts | Introduces page field keys + labels for UI-driven field selection. |
| apps/search/src/components/PageTypesFilterForm.tsx | New UI form for selecting allowed page types (used for indexing filter). |
| apps/search/src/components/AlgoliaPageFieldsSelectionForm.tsx | New UI form for selecting which page fields are sent to Algolia. |
| apps/search/src/components/ImportProductsToAlgolia/index.tsx | Converts barrel to export separate import cards (products/categories/pages). |
| apps/search/src/components/ImportProductsToAlgolia/ImportToAlgoliaCard.tsx | Shared card UI for client-side “initial import” flows. |
| apps/search/src/components/ImportProductsToAlgolia/ImportProductsToAlgolia.tsx | Refactors product import into shared card + new batch upload hook. |
| apps/search/src/components/ImportProductsToAlgolia/ImportCategoriesToAlgolia.tsx | Adds “initial import categories” UI using shared card + new batch upload hook. |
| apps/search/src/components/ImportProductsToAlgolia/ImportPagesToAlgolia.tsx | Adds “initial import pages” UI with guard when no page types are selected. |
| apps/search/src/components/ImportProductsToAlgolia/useUploadState.ts | Extracts upload state management for reuse across import flows. |
| apps/search/src/components/ImportProductsToAlgolia/runBatchedUpload.ts | Adds reusable batching helper for async-generator-based imports. |
| apps/search/src/components/ImportProductsToAlgolia/useGraphQLClient.ts | Adds client-side GraphQL fetching for channels/products/categories/pages (for initial import). |
| apps/search/src/components/ImportProductsToAlgolia/useProductsBatchUpload.ts | New hook implementing product batch import using shared batching helper. |
| apps/search/src/components/ImportProductsToAlgolia/useCategoriesBatchUpload.ts | New hook implementing category batch import using shared batching helper. |
| apps/search/src/components/ImportProductsToAlgolia/usePagesBatchUpload.ts | New hook implementing page batch import using shared batching helper. |
| apps/search/src/components/ImportProductsToAlgolia/useBatchUpload.ts | Replaces old combined hook with re-exports of new per-entity hooks/types. |
| apps/search/src/components/ImportProductsToAlgolia/useBatchUpload.test.ts | Updates tests to cover useProductsBatchUpload instead of the removed combined hook. |
| apps/search/src/components/ImportProductsToAlgolia/useSearchProvider.ts | Ensures Algolia provider gets pageEnabledKeys from config defaults. |
| apps/search/graphql/fragments/PageData.graphql | Adds Page fragment used by webhooks/import queries. |
| apps/search/graphql/subscriptions/pageCreated.graphql | Adds page-created subscription document. |
| apps/search/graphql/subscriptions/pageUpdated.graphql | Adds page-updated subscription document. |
| apps/search/graphql/subscriptions/pageDeleted.graphql | Adds page-deleted subscription document. |
| apps/search/graphql/queries/PagesData.graphql | Adds query used for client-side page import (filtered by page types). |
| apps/search/graphql/queries/PageTypesData.graphql | Adds query used to populate page types selection UI. |
| apps/search/generated/graphql.ts | Updates generated types/documents to include pages + page types queries and subscriptions. |
apps/search/src/components/ImportProductsToAlgolia/usePagesBatchUpload.ts
Show resolved
Hide resolved
apps/search/src/components/ImportProductsToAlgolia/useCategoriesBatchUpload.ts
Show resolved
Hide resolved
| export const webhookPageUpdated = new SaleorAsyncWebhook<PageUpdated>({ | ||
| webhookPath: "api/webhooks/saleor/page-updated", | ||
| event: "PAGE_UPDATED", | ||
| apl: saleorApp.apl, |
There was a problem hiding this comment.
All existing Saleor webhook routes in this app use snake_case (e.g. product_updated, category_created). These new page webhooks introduce kebab-case paths (page-updated, etc.), which is inconsistent and will be harder to reason about. Consider switching webhookPath (and the corresponding API route filename) to snake_case to match the rest of the app.
| Choose which page types should be indexed in Algolia. | ||
| </Text> | ||
| <Text as="p" marginBottom={1.5}> | ||
| If no page types are selected, all pages will be indexed. | ||
| </Text> |
There was a problem hiding this comment.
The UI copy here says that when no page types are selected, all pages will be indexed, but the implementation (ImportPagesToAlgolia + webhooks + import query) treats an empty selection as "no pages indexed". Please align the description with actual behavior (or change the indexing logic to match the copy).
No description provided.