Stephansama/ste 75 fix nocodb api fetch return type#203
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 013e04c 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 |
Summary of ChangesHello @stephansama, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the type definitions within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request updates the typed-nocodb-api package by converting the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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.
Code Review
This pull request correctly fixes the return type of the api.fetch method, which is a significant improvement for the library's type safety and overall developer experience. The implementation refactors the fetch method to be a generic function, which allows for stricter type checking of both the input arguments based on the action and the return value. The necessary updates to the example code in the README and example file are also included. The changes are well-implemented and look good.
More templates
@stephansama/ai-commit-msg
@stephansama/alfred-kaomoji
@stephansama/astro-iconify-svgmap
@stephansama/auto-readme
@stephansama/catppuccin-opml
@stephansama/catppuccin-rss
@stephansama/catppuccin-typedoc
@stephansama/catppuccin-xsl
create-stephansama-example
@stephansama/find-makefile-targets
@stephansama/github-env
@stephansama/multipublish
@stephansama/prettier-plugin-handlebars
@stephansama/remark-asciinema
@stephansama/svelte-social-share-links
@stephansama/typed-events
@stephansama/typed-nocodb-api
@stephansama/typed-templates
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@core/typed-nocodb-api/src/index.ts`:
- Around line 106-107: The closure is mutating `_token` via the side-effect
assignment `_token ??= props.token`, which causes the first non-nullish token to
be cached and subsequent per-call `props.token` to be ignored; change the logic
in the function that computes `token` (the line currently using `_token ??=
props.token`) to avoid mutating `_token` — e.g., compute a local `token` from
`props.token` or `_token` without assignment, or make explicit caching behavior
with a clear API if intended; update references to `_token`, `props.token`, and
the `token` variable accordingly so each call respects the `props.token` passed
in unless deliberate caching is documented.
| const token = (_token ??= props.token); | ||
| if (!token) throw new Error("no token provided"); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Side-effect assignment of _token on every call.
_token ??= props.token silently persists the first non-nullish props.token into the closure for all future calls. If a caller passes a different props.token later, it will be ignored once _token is set. This is pre-existing behavior, but worth noting: with the new public return type making fetch more prominent, consumers may be surprised that per-call tokens are silently dropped after the first.
🤖 Prompt for AI Agents
In `@core/typed-nocodb-api/src/index.ts` around lines 106 - 107, The closure is
mutating `_token` via the side-effect assignment `_token ??= props.token`, which
causes the first non-nullish token to be cached and subsequent per-call
`props.token` to be ignored; change the logic in the function that computes
`token` (the line currently using `_token ??= props.token`) to avoid mutating
`_token` — e.g., compute a local `token` from `props.token` or `_token` without
assignment, or make explicit caching behavior with a clear API if intended;
update references to `_token`, `props.token`, and the `token` variable
accordingly so each call respects the `props.token` passed in unless deliberate
caching is documented.
Checklist
mainhave been mergedmain