-
Couldn't load subscription status.
- Fork 111
Docs for the inbox Schedule page #976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for docs-novu ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdds a new Inbox "Features" manifest and Schedule page, removes "snooze" from the Inbox configuration manifest, updates the Inbox top-level meta to reference "features", expands styling keys for schedule UI, and adds useSchedule documentation for React and React Native plus Schedule docs in the JavaScript SDK. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App as Host App
participant Inbox as Inbox UI
participant Store as Preferences Store
participant Router as Delivery Router
rect #F8FBFF
note right of App: defaultSchedule prop may be provided on mount
App->>Inbox: Mount(defaultSchedule?)
end
User->>Inbox: Open Preferences → Schedule
User->>Inbox: Toggle main schedule / Edit per-day ranges
Inbox-->>Store: Save changes (optimistic auto-save)
Store-->>Inbox: Persist confirmation
alt Notification is non-critical
Router->>Inbox: Check subscriber schedule
Inbox-->>Router: Active? yes/no
alt Inactive
Router--x User: Suppress delivery
else Active
Router-->>User: Deliver notification
end
else Critical workflow
Router-->>User: Deliver regardless of schedule
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (6)
content/docs/platform/inbox/configuration/meta.json (1)
4-6: Description still mentions “snooze” after moving it to Features. Update copy.Replace the description to match the current pages.
Apply:
- "description": "Learn how to configure your inbox with styling, tabs, preferences, data objects, and snooze functionality" + "description": "Learn how to configure your inbox with styling, icons, tabs, preferences, and data objects."content/docs/platform/inbox/features/meta.json (1)
1-6: Tweak section description to reflect Features (Snooze, Schedule) rather than appearance/theming.Current text overlaps with “Configuration.” Suggest clearer wording.
Apply:
- "description": "Learn how to customize the appearance and behavior of the inbox component to match your application’s design system." + "description": "Explore built-in Inbox features like Snooze and Schedule, and learn how they affect notification delivery."content/docs/platform/inbox/features/schedule.mdx (4)
9-11: Add descriptive alt text for accessibility.Empty alt hinders screen reader users; also add alt for the GIF below.
Apply:
- +And at Lines 63-64:
- +
24-29: Timezone example: avoid “CET” which is incorrect during DST; prefer city/zone or “local time”.Minor clarity fix to prevent confusion in summer months.
Apply:
-For example, if a subscriber in Warsaw sets their schedule from 9:00 AM to 5:00 PM, they will receive notifications during those hours in Central European Time (CET). +For example, if a subscriber in Warsaw sets their schedule from 9:00 AM to 5:00 PM, they will receive notifications during those local hours (Europe/Warsaw), with daylight saving time applied automatically.
36-46: Minor copy tighten for “Enable the main schedule” and daily availability bullets.Optional: streamline phrasing and remove redundancy.
Apply:
- The entire feature is controlled by a main schedule toggle. When a subscriber turns this on, they can begin configuring individual days. When it's off, all other settings are inactive, and notifications are delivered normally. + A main Schedule toggle controls the feature. When on, subscribers can configure individual days. When off, per‑day settings are inactive and notifications are delivered normally.
65-68: “Automatic saving” — consider adding a short note about eventual consistency.If persistence is asynchronous, add a sentence like “Changes may take a moment to propagate.”
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
public/images/inbox/schedule.gifis excluded by!**/*.gifpublic/images/inbox/schedule.pngis excluded by!**/*.png
📒 Files selected for processing (4)
content/docs/platform/inbox/configuration/meta.json(1 hunks)content/docs/platform/inbox/features/meta.json(1 hunks)content/docs/platform/inbox/features/schedule.mdx(1 hunks)content/docs/platform/inbox/meta.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Redirect rules - docs-novu
- GitHub Check: Header rules - docs-novu
- GitHub Check: Pages changed - docs-novu
- GitHub Check: Build and Lint
🔇 Additional comments (5)
content/docs/platform/inbox/features/schedule.mdx (4)
11-11: Verify terminology: “critical workflows” matches product naming.If the product uses “priority”/“always deliver,” align the term and consider linking to the definition.
58-62: UI label casing check: “Copy times to...”Ensure the button text matches the UI exactly; if the ellipsis is a single glyph (…) or not present, mirror it here.
1-98: Assets present — no action requiredBoth images exist at public/images/inbox/schedule.png and public/images/inbox/schedule.gif.
71-97: Validate the defaultSchedule prop shape & time format against @novu/react Inbox API.Confirm keys (defaultSchedule.isEnabled, weeklySchedule → day names → hours[{start,end}]) and whether 12‑hour strings with AM/PM (e.g. "09:00 AM") are accepted; if the component requires 24‑hour "HH:mm" or ISO timestamps, update the example in content/docs/platform/inbox/features/schedule.mdx (lines 71–97).
content/docs/platform/inbox/meta.json (1)
5-5: Nav entry “features” looks good — confirm no stale links to removednavigation-and-eventsThe ripgrep run in the sandbox produced no output; absence of output isn't proof of absence. Re-run locally and confirm no references remain, e.g.:
rg -n --hidden -S -C2 "navigation-and-events" content || true git grep -n "navigation-and-events" -- content || true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
content/docs/platform/inbox/configuration/styling.mdx (1)
406-411: Unreachable branch in example (thresholds inverted).
> 1short-circuits the later> 10check; the yellow path is never hit.- if (unreadCount.total > 1) { - return '[--bell-gradient-start:var(--color-red-500)] [--bell-gradient-end:var(--color-red-500)]'; - } - return unreadCount.total > 10 - ? '[--bell-gradient-start:var(--color-yellow-500)] [--bell-gradient-end:var(--color-yellow-500)]' - : '[--bell-gradient-start:var(--color-gray-500)] [--bell-gradient-end:var(--color-gray-500)]'; + if (unreadCount.total > 10) { + return '[--bell-gradient-start:var(--color-yellow-500)] [--bell-gradient-end:var(--color-yellow-500)]'; + } + if (unreadCount.total > 1) { + return '[--bell-gradient-start:var(--color-red-500)] [--bell-gradient-end:var(--color-red-500)]'; + } + return '[--bell-gradient-start:var(--color-gray-500)] [--bell-gradient-end:var(--color-gray-500)]';
🧹 Nitpick comments (5)
content/docs/platform/inbox/configuration/styling.mdx (5)
9-9: Remove unused Tabs import.
Tab, Tabsare not used in this MDX and may trip lint/MDX bundlers.-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
4-4: Hyphenate “pre-built”.Minor docs polish.
-description: 'Learn how to style the pre built Inbox component' +description: 'Learn how to style the pre-built Inbox component'
288-289: Fix typos in Accordion title.Spelling/grammar: “elements” and “customized”.
- <Accordion title="List of elemets that can be customize using the callback function"> + <Accordion title="List of elements that can be customized using the callback function">
88-139: Add severity color variables to the TypeTable.You reference
colorSeverityHigh/Medium/Lowlater; list them here for completeness.type={{ colorBackground: { type: 'string', description: 'The background color of the inbox component.', }, @@ colorShadow: { type: 'string', description: 'The color of shadows applied to elements.', }, + colorSeverityHigh: { + type: 'string', + description: 'Color for high severity notifications and bell accent.', + }, + colorSeverityMedium: { + type: 'string', + description: 'Color for medium severity notifications and bell accent.', + }, + colorSeverityLow: { + type: 'string', + description: 'Color for low severity notifications and bell accent.', + }, fontSize: { type: 'string', description: 'The base font size for text in the inbox.', },
363-388: Schedule keys look consistent; consider linking Schedule type.The callback signatures use
Schedulebut the type isn’t introduced on this page. Add a short note or link to the Schedule feature page or its type definition.Would you like me to propose a small “Schedule context” blurb with a minimal interface example?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/docs/platform/inbox/configuration/styling.mdx(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build and Lint
🔇 Additional comments (1)
content/docs/platform/inbox/configuration/styling.mdx (1)
163-171: Fix selector naming and parity with detailed keys.Short elements table (content/docs/platform/inbox/configuration/styling.mdx lines 163–171) lists
dayScheduleCopy__dropdownContentbut the detailed elements list (lines 364–387) does not; addscheduleDescriptionto the short table and confirm whetherdayScheduleCopy__dropdownContentis actually exported by@novu/react—remove it if not.| Notification list container | `notificationList` | -| Schedule container | `scheduleContainer` | -| Schedule header | `scheduleHeader` | -| Schedule body | `scheduleBody` | -| Schedule table | `scheduleTable` | -| Day schedule copy title | `dayScheduleCopyTitle` | -| Day schedule copy menu | `dayScheduleCopy__dropdownContent` | -| Time select dropdown | `timeSelect__dropdownTrigger` | -| Time select list | `timeSelect__dropdownContent` | +| Schedule container | `scheduleContainer` | +| Schedule header | `scheduleHeader` | +| Schedule description | `scheduleDescription` | +| Schedule body | `scheduleBody` | +| Schedule table | `scheduleTable` | +| Day schedule copy title | `dayScheduleCopyTitle` | +| Time select dropdown | `timeSelect__dropdownTrigger` | +| Time select list | `timeSelect__dropdownContent` |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (8)
content/docs/platform/sdks/react/hooks/use-schedule.mdx (8)
6-8: Remove unused imports.
Tab/Tabsaren’t used; keep the file lean.import { TypeTable } from 'fumadocs-ui/components/type-table'; -import { Tab, Tabs } from "fumadocs-ui/components/tabs";
41-50: Don’t hardcode “default: true” for booleans.
isLoading/isFetchingare dynamic. Remove the default fields to avoid misleading readers.isLoading: { type: "boolean", - description: "True during the initial load, false otherwise", - default: "true", + description: "True during the initial load; false after success/error", }, isFetching: { type: "boolean", description: "True while any request is in flight (initial load or refetch), false otherwise", - default: "true", },
84-86: Clarify time format, timezone, and validation for hours.Readers need the accepted format and TZ assumption to avoid API errors.
hours: { type: "Array<{ start: string; end: string; }>", - description: "An array of time ranges for when notifications are allowed. Multiple ranges per day are supported (for example, 9-12 AM and 2-5 PM).", + description: "Array of allowed time ranges. Supported formats: 'HH:mm' (24‑hour) or 'h:mm A' (12‑hour). Times are interpreted in the subscriber’s timezone. Ranges must not overlap and start must be earlier than end.", },
94-106: Fix time format and call the updater consistently.Avoid mixing 24‑hour with AM/PM, and call the updater as documented (see Return value comment).
-const handleClick = async () => { - await schedule?.update({ +const handleClick = async () => { + await update({ isEnabled: true, weeklySchedule: { monday: { isEnabled: true, - hours: [{ start: '08:00 AM', end: '18:00 PM' }], + hours: [{ start: '08:00 AM', end: '06:00 PM' }], }, } }) };
113-117: Destructure the updater from the hook.Keep example API consistent and Typescript-friendly.
-import { useSchedule } from "@novu/react"; +import { useSchedule } from "@novu/react"; function ScheduleManager() { - const { schedule, isLoading, error, refetch } = useSchedule(); + const { schedule, isLoading, error, refetch, update } = useSchedule();
121-147: Use the updater function and await refetch for consistency.Also removes optional chaining on the updater.
const handleUpdateSchedule = async () => { try { - await schedule?.update({ + await update({ isEnabled: true, weeklySchedule: { monday: { isEnabled: true, hours: [ { start: '09:00 AM', end: '12:00 PM' }, { start: '02:00 PM', end: '05:00 PM' }, ], }, tuesday: { isEnabled: true, hours: [{ start: '09:00 AM', end: '05:00 PM' }], }, // Other days can be left undefined or explicitly disabled wednesday: { isEnabled: false, hours: [], }, }, }); - // Refresh the schedule data after updating - refetch(); + // Refresh the schedule data after updating + await refetch(); } catch (e) { console.error("Failed to update schedule:", e); } };
161-165: Use optional chaining (or local alias) when mapping Monday hours.Prevents TS narrowing issues and avoids edge-case NPEs if types change.
- {schedule.weeklySchedule.monday.hours.map((range, index) => ( + {schedule?.weeklySchedule?.monday?.hours?.map((range, index) => ( <li key={index}>{`${range.start} - ${range.end}`}</li> ))}
68-72: Enumerate allowed day keys for weeklySchedule.Small clarity gain; avoids ambiguity in community translations and validations.
weeklySchedule: { type: "object", - description: "An object containing the schedule for each day of the week (for example, monday, tuesday). Each key holds a DaySchedule object.", + description: "Object with keys: monday, tuesday, wednesday, thursday, friday, saturday, sunday. Each key holds a DaySchedule object.", },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/docs/platform/sdks/react/hooks/use-schedule.mdx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Redirect rules - docs-novu
- GitHub Check: Header rules - docs-novu
- GitHub Check: Pages changed - docs-novu
- GitHub Check: Build and Lint
🔇 Additional comments (1)
content/docs/platform/sdks/react/hooks/use-schedule.mdx (1)
31-56: Return value docs conflict with example usage (schedule.update)content/docs/platform/sdks/react/hooks/use-schedule.mdx — lines 31-56:
scheduleis documented as plain data (Schedule | undefined) but examples callschedule.update(...). Either expose an updater separately or documentscheduleas an object with methods. Proposed Option A (update TypeTable and examples):<TypeTable type={{ schedule: { type: "Schedule | undefined", description: "The subscriber's current schedule object", typeDescription: "undefined if data is not yet loaded", }, + update: { + type: "(patch: Partial<Schedule>) => Promise<Schedule>", + description: "Create or update the subscriber's schedule.", + }, + isUpdating: { + type: "boolean", + description: "True while an update request is in flight.", + }, error: { type: "NovuError | undefined", description: "Error object if the request failed", }, isLoading: { - description: "True during the initial load, false otherwise", - default: "true", + description: "True during the initial load; false after success/error", }, isFetching: { type: "boolean", description: "True while any request is in flight (initial load or refetch), false otherwise", - default: "true", }, refetch: { - type: "() => Promise<void>", + type: "() => Promise<unknown>", description: "Function to manually trigger a refetch of the schedule", }, }} />
|
|
||
| ## Schedule type | ||
|
|
||
| The `Schedule` type from `@novu/react` includes these properties: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add intro paragraphs to the previous two sections so that they are consistent with this one.
Co-authored-by: DianaHackmamba <[email protected]>
Co-authored-by: DianaHackmamba <[email protected]>
Co-authored-by: DianaHackmamba <[email protected]>
Co-authored-by: DianaHackmamba <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
content/docs/platform/inbox/configuration/styling.mdx (1)
405-411: Fix unreachable condition in example logic.
unreadCount.total > 10is checked only in the else branch of> 1, so it never runs. Reverse the order.Apply this diff:
- bellIcon: ({ unreadCount }) => { - if (unreadCount.total > 1) { - return '[--bell-gradient-start:var(--color-red-500)] [--bell-gradient-end:var(--color-red-500)]'; - } - return unreadCount.total > 10 - ? '[--bell-gradient-start:var(--color-yellow-500)] [--bell-gradient-end:var(--color-yellow-500)]' - : '[--bell-gradient-start:var(--color-gray-500)] [--bell-gradient-end:var(--color-gray-500)]'; - }, + bellIcon: ({ unreadCount }) => { + if (unreadCount.total > 10) { + return '[--bell-gradient-start:var(--color-yellow-500)] [--bell-gradient-end:var(--color-yellow-500)]'; + } + if (unreadCount.total > 1) { + return '[--bell-gradient-start:var(--color-red-500)] [--bell-gradient-end:var(--color-red-500)]'; + } + return '[--bell-gradient-start:var(--color-gray-500)] [--bell-gradient-end:var(--color-gray-500)]'; + },
🧹 Nitpick comments (1)
content/docs/platform/inbox/configuration/styling.mdx (1)
168-171: Unify dropdown terminology for consistency.Use “drop-down content” to match the “drop-down list” phrasing above and avoid mixing “menu/list”.
Apply this diff:
-| Day schedule copy menu | `dayScheduleCopy__dropdownContent` | -| Time select list | `timeSelect__dropdownContent` | +| Day schedule copy drop-down content | `dayScheduleCopy__dropdownContent` | +| Time select drop-down content | `timeSelect__dropdownContent` |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
public/images/inbox/inbox-schedule.pngis excluded by!**/*.png
📒 Files selected for processing (5)
content/docs/platform/inbox/configuration/styling.mdx(2 hunks)content/docs/platform/inbox/features/schedule.mdx(1 hunks)content/docs/platform/sdks/react-native/hooks/meta.json(1 hunks)content/docs/platform/sdks/react-native/hooks/use-schedule.mdx(1 hunks)content/docs/platform/sdks/react/hooks/use-schedule.mdx(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- content/docs/platform/sdks/react/hooks/use-schedule.mdx
- content/docs/platform/sdks/react-native/hooks/use-schedule.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- content/docs/platform/inbox/features/schedule.mdx
🔇 Additional comments (5)
content/docs/platform/inbox/configuration/styling.mdx (2)
169-169: Past suggestion applied — looks good.“Time select drop-down list |
timeSelect__dropdownTrigger” reflects the earlier review suggestion. No further changes needed here.
363-388: Confirm callback support for dropdown elements.The Schedule callback list omits
dayScheduleCopy__dropdownContent,timeSelect__dropdownTrigger, andtimeSelect__dropdownContent. If these accept contextual callbacks, please add them; if not, add a brief note that these elements are class-only (no context).content/docs/platform/sdks/react-native/hooks/meta.json (3)
2-9: LGTM: RN hooks meta now exposes use-scheduleEntry looks correct and consistent with existing slugs. JSON is valid.
8-8: Verify frontmatter slug parity for use-schedule
- All pages listed in content/docs/platform/sdks/react-native/hooks/meta.json are present.
- content/docs/platform/sdks/react-native/hooks/use-schedule.mdx has title "useSchedule" and no "slug" frontmatter — add slug: "use-schedule" or confirm the site/build derives the slug from the filename.
2-9: Optional: confirm nav ordering policyVerification script produced no output so I couldn't compare ordering across SDKs. Confirm whether hooks are alphabetized after
novu-providerelsewhere — if yes, reorder this file's "pages" array to match; otherwise ignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (8)
content/docs/platform/sdks/react/hooks/use-schedule.mdx (5)
60-73: Name the WeeklySchedule shape explicitly.Readers benefit from seeing concrete keys. Consider adding a brief note like: “weeklySchedule has keys: monday … sunday (DaySchedule).”
I can add a tiny TypeTable for
WeeklyScheduleif you want.
77-88: Document expected time format forhours.Specify whether times are 24‑hour (“HH:mm”) or 12‑hour with AM/PM. Without this, users may pass invalid values.
Want me to add a one‑liner note and validation example?
95-106: Fix invalid time literal (“18:00 PM”).Use either 24‑hour or AM/PM consistently.
Apply:
- hours: [{ start: '08:00 AM', end: '18:00 PM' }], + // 12-hour format + hours: [{ start: '08:00 AM', end: '06:00 PM' }], + // or 24-hour format + // hours: [{ start: '08:00', end: '18:00' }],
153-160: Guard against undefinedhoursto avoid runtime errors.If
monday.isEnabledis true buthoursis missing,.mapwill throw.Apply:
- {schedule.weeklySchedule.monday.hours.map((range, index) => ( + {(schedule.weeklySchedule.monday.hours ?? []).map((range, index) => ( <li key={index}>{`${range.start} - ${range.end}`}</li> ))}
75-88: Add a subheading for DaySchedule for scannability.Insert “### DaySchedule” before the structure.
Apply:
-Each `DaySchedule` object within `weeklySchedule` has the following structure: +### DaySchedule + +Each `DaySchedule` object within `weeklySchedule` has the following structure:content/docs/platform/sdks/javascript/index.mdx (3)
472-477: Prefertscode fence for JS SDK snippets.These examples aren’t JSX; switch
tsx→tsfor accuracy.Apply:
-```tsx +```ts const novu = new Novu(...); const { data: { schedule } } = await novu.preferences.schedule.get();
482-494: Same: usetsfence and compact example.Apply:
-```tsx +```ts const novu = new Novu(...); // Update schedule via preferences const { data: { schedule } } = await novu.preferences.schedule.update({ weeklySchedule: { monday: { isEnabled: true, hours: [{ start: '09:00 AM', end: '05:00 PM' }], }, }, }); // Or update directly from a Schedule instance const { data: { schedule: updatedSchedule } } = await schedule.update({ isEnabled: false });--- `555-557`: **Show `get.resolved` example too for completeness.** Add a snippet to help users subscribe to schedule fetch events. Apply: ```diff novu.on('preferences.schedule.update.resolved', ({ data }) => { console.log('Schedule updated:', data.schedule); }); + +novu.on('preferences.schedule.get.resolved', ({ data }) => { + console.log('Schedule fetched:', data.schedule); +});
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
content/docs/platform/inbox/features/schedule.mdx(1 hunks)content/docs/platform/sdks/javascript/index.mdx(3 hunks)content/docs/platform/sdks/react-native/hooks/use-schedule.mdx(1 hunks)content/docs/platform/sdks/react/hooks/use-schedule.mdx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- content/docs/platform/sdks/react-native/hooks/use-schedule.mdx
- content/docs/platform/inbox/features/schedule.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Redirect rules - docs-novu
- GitHub Check: Header rules - docs-novu
- GitHub Check: Build and Lint
- GitHub Check: Pages changed - docs-novu
🔇 Additional comments (6)
content/docs/platform/sdks/react/hooks/use-schedule.mdx (4)
13-25: Clarify error type and callback semantics for consistency.Confirm that errors are surfaced as values (Result-style) and not thrown, and that
onErrorreceives aNovuError. If some implementations pass a genericError, reflect that here.Would you like me to propose wording that highlights the
{ data, error }pattern across hooks?
29-56: Tighten return types and remove misleading “default: true” flags.
refetchrarely needs to be called and its type isn’t() => Promise<void>in React Query. Either omit the explicit type or align with the actual TS type.isLoading/isFetchingdon’t have static defaults; remove the “default: true” rows to avoid misleading readers.Apply:
isLoading: { type: "boolean", - description: "True during the initial load, false otherwise", - default: "true", + description: "True during the initial load; controlled by network state", }, isFetching: { type: "boolean", description: "True while any request is in flight (initial load or refetch), false otherwise", - default: "true", + // no static default; depends on network state }, refetch: { - type: "() => Promise<void>", - description: "Function to manually trigger a refetch of the schedule", + // Prefer not to hardcode a signature here; it’s React Query’s refetch fn. + type: "Refetch function", + description: "Manually trigger a refetch (usually unnecessary)", },
108-117: Droprefetchfrom the example; it auto‑updates.The schedule returned by the hook re-renders on update; refetch isn’t needed in this example.
Apply:
-function ScheduleManager() { - const { schedule, isLoading, error, refetch } = useSchedule(); +function ScheduleManager() { + const { schedule, isLoading, error } = useSchedule();
121-143: Show result‑style update handling ({ data, error }) in example.Public functions return values/errors instead of throwing; reflect that pattern.
Apply:
- const handleUpdateSchedule = async () => { - await schedule?.update({ + const handleUpdateSchedule = async () => { + const { data: updated, error } = await schedule?.update({ isEnabled: true, weeklySchedule: { monday: { isEnabled: true, hours: [ { start: '09:00 AM', end: '12:00 PM' }, { start: '02:00 PM', end: '05:00 PM' }, ], }, tuesday: { isEnabled: true, hours: [{ start: '09:00 AM', end: '05:00 PM' }], }, // Other days can be left undefined or explicitly disabled wednesday: { isEnabled: false, hours: [], }, }, - }); + }); + if (error) { + // surface error in UI or toast + return; + } + // optionally use `updated` };content/docs/platform/sdks/javascript/index.mdx (2)
530-533: Event names look good; consider adding corresponding.rejectedevents if they exist.If there are error events (e.g.,
.rejected), list them for parity.I can add them once you confirm the emitted names from the SDK.
504-518: FixSchedule.updatesignature to allow togglingisEnabled.File: content/docs/platform/sdks/javascript/index.mdx (lines ~504-518)
Docs show
schedule.update({ isEnabled: false })but the parameter is typed asPartial<WeeklySchedule>; change toPartial<Schedule>.Apply:
"update": { "description": "Update the schedule with partial data", - "type": "(schedule: Partial<WeeklySchedule>) => Result<Schedule>" + "type": "(schedule: Partial<Schedule>) => Result<Schedule>" }
Summary by CodeRabbit
New Features
Documentation
Style