Skip to content

feat(ui): add NotificationProvider #7967

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

Merged
merged 1 commit into from
Jul 10, 2025
Merged

feat(ui): add NotificationProvider #7967

merged 1 commit into from
Jul 10, 2025

Conversation

avivkeller
Copy link
Member

Ref: nodejs/api-docs-tooling#285 (comment)

This moves the NotificationProvider into ui-components so it can be used in our documentation generator

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 23:06
@avivkeller avivkeller requested review from a team as code owners July 8, 2025 23:06
Copy link

vercel bot commented Jul 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jul 8, 2025 11:08pm

Copy link
Contributor

@Copilot 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 moves the NotificationProvider (and its hook) into the ui-components package, removes outdated site‐specific implementations/tests, and updates the site app to consume the shared provider.

  • Introduce NotificationProvider and useNotification in ui-components
  • Remove local notificationProvider and hook implementations/tests from the site app
  • Update site app to import and use the new provider/hook and clean up obsolete dependencies

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ui-components/src/Providers/NotificationProvider.tsx Implement shared NotificationProvider and useNotification hook
packages/ui-components/src/Providers/tests/NotificationProvider.test.jsx Add tests for useNotification behavior within and outside the provider
apps/site/package.json Remove now-unnecessary @radix-ui/react-toast dependency
apps/site/layouts/Base.tsx Switch import to use NotificationProvider from ui-components
apps/site/components/Common/CodeBox.tsx Remove obsolete site-specific useNotification import
apps/site/hooks/react-client/index.ts Remove useNotification export
apps/site/hooks/react-server/index.ts Remove useNotification export
apps/site/hooks/react-client/useNotification.ts (deleted) Delete local client hook implementation
apps/site/hooks/react-server/useNotification.ts (deleted) Delete local server hook stub
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)

packages/ui-components/src/Providers/tests/NotificationProvider.test.jsx:3

  • The test is importing describe and it from node:test while using @testing-library/react. Consider using your test runner's global describe/it (e.g., Jest) or adjust your setup to avoid mixing frameworks.
import { describe, it } from 'node:test';

packages/ui-components/src/Providers/tests/NotificationProvider.test.jsx:32

  • This test expects useNotification() outside the provider to return null, but the default context value for dispatch is a no-op function (truthy). Update the test to match the implementation or change the default context to null.
    it('should return null outside NotificationProvider', () => {

apps/site/components/Common/CodeBox.tsx:6

  • The imported useNotification hook is not used in this file. Consider removing the unused import to clean up the code.
import { useNotification } from '@node-core/ui-components/Providers/NotificationProvider';

@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Jul 8, 2025
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 73.03%. Comparing base (e1f87bd) to head (e2ac2ed).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...-components/src/Providers/NotificationProvider.tsx 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7967      +/-   ##
==========================================
- Coverage   73.66%   73.03%   -0.64%     
==========================================
  Files          96       95       -1     
  Lines        8354     8347       -7     
  Branches      220      218       -2     
==========================================
- Hits         6154     6096      -58     
- Misses       2199     2250      +51     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

openjs-vercel
openjs-vercel previously approved these changes Jul 8, 2025
@avivkeller avivkeller dismissed openjs-vercel’s stale review July 8, 2025 23:59

Dismissed for security reasons

@avivkeller avivkeller added this pull request to the merge queue Jul 10, 2025
Merged via the queue into main with commit 4d3182b Jul 10, 2025
17 checks passed
@avivkeller avivkeller deleted the feat/ui/notify-provide branch July 10, 2025 11:22
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.

6 participants