Skip to content

Release v3.4.4#114

Merged
happycastle114 merged 3 commits intoreleasefrom
rc
Aug 4, 2025
Merged

Release v3.4.4#114
happycastle114 merged 3 commits intoreleasefrom
rc

Conversation

@happycastle114
Copy link
Contributor

@happycastle114 happycastle114 commented Aug 4, 2025

Summary by CodeRabbit

  • New Features

    • Introduced an "Update" page that displays Notion content directly within the app.
    • Added a new route to access the "Update" page.
  • Improvements

    • Enabled infinite scrolling in the lecture list, allowing users to load more lectures as they scroll.
    • Reduced the number of lecture search results loaded at once for improved performance.
  • Chores

    • Added the "react-notion" library to support Notion page rendering.

MBP16 and others added 3 commits August 4, 2025 11:38
* feat: add update page based on notion

* style: update asynchronous pattern

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: UpdatePage to use constants for default IDs

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 4, 2025 15:37
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The updates introduce infinite scrolling to the lecture list in the timetable section, adjust search result limits, and add a new "UpdatePage" route and component that fetches and displays Notion content. Supporting changes include a new dependency (react-notion), minor refactoring in course list logic, and updates to routing.

Changes

Cohort / File(s) Change Summary
Dependency Update
package.json
Added the react-notion dependency (^0.10.0) to support Notion page rendering. No other dependency or configuration changes.
Course List Refactor
src/components/sections/dictionary/courselist/CourseListSection.jsx
Removed initialization of offSetRef and the componentDidMount method, simplifying the component's setup. No changes to rendering or external behavior.
Lecture List Infinite Scroll
src/components/sections/timetable/lecturelist/LectureListSection.jsx
Implemented infinite scrolling: added _addLectureGroups to fetch more lectures as the user scrolls, updated the scroll handler, and connected new Redux dispatch props. Ensured state consistency with year/semester checks and included (empty) error handling. Updated prop types accordingly.
Lecture Search Limit Adjustment
src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx
Reduced the search result limit from 300 to 50, explicitly passed limit and offset to the API, and commented out the alert for hitting the result limit. No other logic changes.
Routing Update
src/index.tsx
Imported the new UpdatePage and added a route at /update to render this component. No other routing or logic modifications.
New Notion Page Renderer
src/pages/UpdatePage.tsx
Introduced UpdatePage, a React component that fetches and displays Notion content using react-notion. Handles Notion API fetch, processes block data, checks for official space, and renders the page with custom URL mapping and styling. Redirects if the Notion space is not official.

Sequence Diagram(s)

Infinite Scrolling in Lecture List

sequenceDiagram
    participant User
    participant Scroller
    participant LectureListSection
    participant Server
    participant ReduxStore

    User->>Scroller: Scrolls to bottom
    Scroller->>LectureListSection: onScrollChange event
    LectureListSection->>LectureListSection: _addLectureGroups()
    LectureListSection->>Server: Fetch lectures (offset, limit)
    Server-->>LectureListSection: Returns lecture data
    LectureListSection->>ReduxStore: setListLecturesDispatch (append lectures)
    LectureListSection->>LectureListSection: Update state with new lectures
Loading

Rendering Notion Page in UpdatePage

sequenceDiagram
    participant User
    participant UpdatePage
    participant NotionAPI
    participant Browser

    User->>UpdatePage: Navigates to /update?pageId=...
    UpdatePage->>NotionAPI: Fetch Notion page data
    NotionAPI-->>UpdatePage: Returns block map JSON
    UpdatePage->>UpdatePage: Filter/process block map, extract space_id
    UpdatePage->>Browser: Redirect if space_id is not official
    UpdatePage->>User: Render Notion page content
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇
A scroll, a fetch, more lectures appear,
Notion pages rendered, updates are near.
Limits made smaller, alerts now at rest,
A new page for news, in style and in jest.
With hops and with code,
This rabbit’s bestowed
Fresh features for all—enjoy the new load!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2891812 and 80add2d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • package.json (1 hunks)
  • src/components/sections/dictionary/courselist/CourseListSection.jsx (0 hunks)
  • src/components/sections/timetable/lecturelist/LectureListSection.jsx (7 hunks)
  • src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx (3 hunks)
  • src/index.tsx (2 hunks)
  • src/pages/UpdatePage.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rc

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@happycastle114 happycastle114 merged commit f82191f into release Aug 4, 2025
5 of 6 checks passed
Copy link
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 implements a new update page feature and enhances lecture search functionality with pagination support. The changes add the ability to display Notion-based content and implement infinite scrolling for lecture search results.

  • Added a new UpdatePage component that renders Notion content with security validation
  • Modified lecture search to use pagination with a reduced limit and infinite scrolling
  • Added necessary dependencies and routing for the new functionality

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/pages/UpdatePage.tsx New component for displaying Notion-based update content with space ID validation
src/index.tsx Added routing for the new update page
src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx Reduced search limit and added pagination parameters
src/components/sections/timetable/lecturelist/LectureListSection.jsx Added infinite scrolling functionality for lecture search results
src/components/sections/dictionary/courselist/CourseListSection.jsx Removed unused reference and lifecycle method
package.json Added react-notion dependency
Comments suppressed due to low confidence (1)

package.json:49

  • The react-notion package version ^0.10.0 appears to be non-existent. The latest available version is much lower (around 0.2.x).
    "react-notion": "^0.10.0"

Comment on lines +14 to +29
const query = new URLSearchParams(window.location.search);
const pageId = query.get('pageId') || DEFAULT_PAGE_ID;
const [spaceId, setSpaceId] = useState('');

useEffect(() => {
const fetchNotionData = async () => {
const res = await fetch(`https://notion-api.splitbee.io/v1/page/${pageId}`);
const json = await res.json();
Object.keys(json).forEach((key) => {
if (json[key].role === 'none') {
delete json[key];
} else {
setSpaceId(json[key].value.space_id);
}
});
setBlockMap(json);
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The fetch operation lacks error handling. If the API request fails, the component will not provide feedback to the user about the failure.

Suggested change
const query = new URLSearchParams(window.location.search);
const pageId = query.get('pageId') || DEFAULT_PAGE_ID;
const [spaceId, setSpaceId] = useState('');
useEffect(() => {
const fetchNotionData = async () => {
const res = await fetch(`https://notion-api.splitbee.io/v1/page/${pageId}`);
const json = await res.json();
Object.keys(json).forEach((key) => {
if (json[key].role === 'none') {
delete json[key];
} else {
setSpaceId(json[key].value.space_id);
}
});
setBlockMap(json);
const [error, setError] = useState<string | null>(null);
const query = new URLSearchParams(window.location.search);
const pageId = query.get('pageId') || DEFAULT_PAGE_ID;
const [spaceId, setSpaceId] = useState('');
useEffect(() => {
const fetchNotionData = async () => {
try {
const res = await fetch(`https://notion-api.splitbee.io/v1/page/${pageId}`);
if (!res.ok) {
throw new Error(`Failed to fetch data: ${res.status} ${res.statusText}`);
}
const json = await res.json();
Object.keys(json).forEach((key) => {
if (json[key].role === 'none') {
delete json[key];
} else {
setSpaceId(json[key].value.space_id);
}
});
setBlockMap(json);
} catch (err: any) {
setError(err.message || 'An error occurred while fetching data.');
}

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +28
} else {
setSpaceId(json[key].value.space_id);
}
});
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The spaceId is being set multiple times in the loop, potentially overwriting previous values. This could lead to inconsistent behavior if multiple blocks have different space_ids.

Suggested change
} else {
setSpaceId(json[key].value.space_id);
}
});
}
});
// Set spaceId from the root block (pageId)
if (json[pageId] && json[pageId].value && json[pageId].value.space_id) {
setSpaceId(json[pageId].value.space_id);
}

Copilot uses AI. Check for mistakes.
const option = {
...lastSearchOption,
offset,
limit: offset + REFRESH_LIMIT,
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The limit parameter should be REFRESH_LIMIT, not offset + REFRESH_LIMIT. The current implementation requests an increasing number of items instead of a fixed batch size.

Suggested change
limit: offset + REFRESH_LIMIT,
limit: REFRESH_LIMIT,

Copilot uses AI. Check for mistakes.
}

onScrollChange = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e;
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The destructuring is incorrect. Scroll event properties should be accessed from e.target, not directly from e.

Suggested change
const { scrollTop, scrollHeight, clientHeight } = e;
const { scrollTop, scrollHeight, clientHeight } = e.target;

Copilot uses AI. Check for mistakes.
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.

5 participants