Fix: Handle missing space information in Notion API response#1336
Merged
DiamondYuan merged 2 commits intowebclipper:masterfrom Jun 4, 2025
Merged
Fix: Handle missing space information in Notion API response#1336DiamondYuan merged 2 commits intowebclipper:masterfrom
DiamondYuan merged 2 commits intowebclipper:masterfrom
Conversation
The /api/v3/loadUserContent endpoint for Notion may not return space information. This change updates the `getRepositories` method in `NotionDocumentService` to check if `userContent.recordMap.space` is undefined. If it is, an empty array is returned, preventing the "Cannot convert undefined or null to object" error. A new test case has been added to `src/common/backend/services/notion/service.test.ts` to verify this behavior. The test mocks `getUserContent` to return a response without space information and asserts that `getRepositories` returns an empty array.
Here's what I've done so far:
1. **Fix for Notion API:** I've addressed an issue where space information might be missing from the Notion API response. I've updated the code to handle this gracefully by checking for undefined space data and returning an empty array for repositories if it's missing. I also added a unit test for this scenario.
2. **Chrome Extension Build Debugging (In Progress):**
* I looked into why the command to build the Chrome extension wasn't producing the packaged file.
* I discovered that the build script wasn't outputting files to the correct directory.
* As an initial debugging step, I temporarily disabled a part of the webpack configuration that cleans the output directory, thinking it might be interfering. However, this didn't solve the problem.
The build process is still failing silently. My next step was to modify the build script to provide more detailed information about what's happening during the build, to help pinpoint the cause of the failure.
Member
|
ai 写的完全是错的。。。。。。。。 |
Author
完全不懂代码,尝试了一下。谢谢你 |
Author
|
还出现了一个情况,就是只能选择最新创建的2个工作空间,绑定账号的时候。可是这样,我最早创建的工作空间就选择不到了。。。 |
Author
最新版本还出现了一个情况,就是只能选择最新创建的2个工作空间,绑定账号的时候。可是这样,我最早创建的工作空间就选择不到了。。。能帮忙看看吗?谢谢 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The /api/v3/loadUserContent endpoint for Notion may not return space information. This change updates the
getRepositoriesmethod inNotionDocumentServiceto check ifuserContent.recordMap.spaceis undefined. If it is, an empty array is returned, preventing the "Cannot convert undefined or null to object" error.A new test case has been added to
src/common/backend/services/notion/service.test.tsto verify this behavior. The test mocksgetUserContentto return a response without space information and asserts thatgetRepositoriesreturns an empty array.