-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: add dedupe feature, params option, and more #99
Open
Ryan-Zayne
wants to merge
73
commits into
main
Choose a base branch
from
feature/dedupe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
feat: Add params feature - Added vite-env.d.ts file for Vite client types - Added tsconfig.json file for TypeScript configuration - Added pnpm-workspace.yaml file for pnpm workspace configuration - Deleted tsconfig.eslint.json file - Added client.ts file with a fetchStuff function - Added README.md file with installation and run instructions - Added .gitignore file to ignore logs, editor files, and build artifacts - Added server.ts file with a foo variable and console.log statements - Updated eslint.config.js file to use tsconfig.json as the default project - Added index.html file with basic HTML structure and script import - Updated autofix.yml, size-limit.yml, lint-and-type.yml, test--release-and-publish.yml, and changeset--release-and-publish.yml workflows to use pnpm version 9.10.0 - Updated package.json file with dependencies and devDependencies - Added pnpm-lock.yaml file with lockfile information - Updated types.ts file to include params property in ExtraOptions interface - Updated typeof.ts file to use isArray and isString helper functions - Updated theme.config.tsx file to remove eslint-disable comments - Added vite.svg file for Vite logo
🦋 Changeset detectedLatest commit: 5fb5d44 The changes in this PR will be included in the next version bump. 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 |
✅ Deploy Preview for zayne-callapi canceled.
|
commit: |
Ryan-Zayne
changed the title
feat: Add Vite configuration files and dependencies
feat: Add Vite configuration files and Params feature
Sep 17, 2024
The dedupeStrategy option in the createFetchClient function has been updated to use the "cancel" strategy instead of the deprecated cancelRedundantRequests option. This change ensures that the previous pending request to the same URL will be cancelled and allows the new request to go through. The cancelRedundantRequests option is now deprecated and should be replaced with dedupeStrategy === "cancel". Refactor the code in createFetchClient.ts to reflect this change.
The createFetchClient function now supports a new dedupeStrategy option that allows controlling the behavior when a duplicate request is detected. The "cancel" strategy will cancel the previous pending request, while the "defer" strategy will return the response from the previous request. This change ensures that the previous pending request to the same URL will be cancelled and allows the new request to go through. The cancelRedundantRequests option is now deprecated and should be replaced with dedupeStrategy === "cancel". Additionally, the types.ts and utils.ts files have been updated to support the new dedupeStrategy option and related functionality.
refactor: ensure caching mechanism only works if a key is available
…recate cancelRedundantRequests option, and stabilize current API
…recate cancelRedundantRequests option, and stabilize current API
… createFetchClient
This commit updates the map types in the `types.ts` file and adds a new type helper called `Awaitable` in the `type-helpers.ts` file. The map types have been modified to include the `Awaitable` type, which represents a promise or a non-promise value. This change improves the type safety and readability of the codebase. Refactor the map types and add Awaitable type helper
Ryan-Zayne
changed the title
feat: Add Vite configuration files and Params feature
feat: Add Dedupe and Params feature
Sep 22, 2024
This commit deduplicates interceptors in the `handleMergeInterceptors` function. It ensures that only unique interceptors are executed by creating a new array of unique interceptors before mapping and executing them. This change improves the efficiency and reliability of the interceptor handling logic. Additionally, this commit updates the package.json version to 1.0.0-rc-7.
- Allows the `TBaseResultMode` generic type parameter in the `createFetchClient` function to be `undefined`, which will default to `ResultModeUnion`. - This provides more flexibility in the usage of the `createFetchClient` function, allowing users to omit the `TBaseResultMode` type parameter if they want to use the base result mode. - Updates the `GetCallApiResult` type to handle the case where `TResultMode` is `undefined`.
feat(createFetchClient): add onSuccess interceptor refactor(createFetchClient): update response and error interceptors refactor(types): add onSuccess interceptor to ExtraOptions
…cution - Allows the `TBaseResultMode` generic type parameter in the `createFetchClient` function to be `undefined`, which will default to `ResultModeUnion`. - Provides more flexibility in the usage of the `createFetchClient` function, allowing users to omit the `TBaseResultMode` type parameter if they want to use the base result mode. - Updates the `callApi` function to use the `TBaseResultMode` as the default for the `TResultMode` parameter when it is not provided. - Introduces new utility functions `createCombinedSignal` and `createTimeoutSignal` to simplify the creation of combined abort signals. - Refactors the `executeInterceptors` function to execute interceptors in parallel. - Updates the `handleInterceptorsMerge` function to use the new `mergeInterceptors` option instead of `shouldMergeInterceptors`. - Removes the `shouldMergeInterceptors` option from the `ExtraOptions` interface.
…tions for consistency
…n and utility functions feat(callapi-legacy): Release package to cater for the needs of older node versions
…rect workspace location
fix(eslint): adjust tsconfigPath to include an empty string for ESLint configuration
fix(eslint): specify tsconfig path for dev environment
fix(package): update lint:eslint script to build before linting
fix(callapi): update Node.js engine version in package.json fix(callapi-legacy): update Node.js engine version in package.json fix(docs): update _app.tsx to import tailwind.css fix(dependencies): add new ESLint plugins to devDependencies fix(eslint): enhance ESLint configuration for React and Next.js
…tion and utility functions
…equestKey option - Enhance resolveHeaders function to handle various types of auth and body options - Add requestKey option to callApi function in dev/src/client.ts
…lveHeaders function - Update the RequestOptions interface to use Pick<RequestInit, FetchSpecificKeysUnion> instead of extending CallApiConfig - Update the resolveHeaders function to use the request.body and request.headers instead of options.body and options.headers
…ent and resolveErrorResult functions
…ions for error handling and request context
…st deduplication - Update the resolveHeaders function to handle various types of auth and body options - Add requestKey option to callApi function in dev/src/client.ts - Enhance error handling in createFetchClient to better distinguish between HTTP and JavaScript errors - Improve request deduplication logic to provide more informative abort messages - Add Register interface to allow custom meta types
…llation messaging
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.
feat: Add params feature
feat: Add dedupe feature
feat!: move cjs support to legacy entrypoint
refactor: cleaned up some parts of the logic
feat!: deprecate cancelRedundantRequest option
feat: add support for composing interceptors, and relevant options
feat: a few code and perf improvements
Description
Please include a summary of the change and which issue is fixed (if applicable).
Related Issue
Contribution Guidelines
Before submitting this pull request, please review our Contribution Guidelines to understand how to contribute to this project.
Checklist
Screenshots (if applicable)
Additional context (if needed)