Skip to content
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: @rematch/loading with type: 'full' returns success/error/loading #922

Merged
merged 8 commits into from Aug 12, 2021

Conversation

semoal
Copy link
Member

@semoal semoal commented Aug 11, 2021

Finally found some time to work on this cool feature.

This introduces a little breaking change (which is not, because under the hood adapts the configuration to match the newest one if users are using the old one)

Basically now @rematch/loading plugin accepts a type property (By default is type: boolean)

This property accepts: 'number', 'boolean', 'full'

{ type: "full" }

Basically returns { success: false, loading: true, error: false }, if the effect promise returns an error the error response is added to error.

Works fine with Typescript as far as I could check.

Pending

  • Decide if 'detailed' is a good name
  • Documentation
  • More testing
  • Reduce bundle size a bit (there're some optimisations)

Will resolve #877

@semoal semoal requested a review from tianzhich August 11, 2021 16:21
@github-actions
Copy link

github-actions bot commented Aug 11, 2021

size-limit report 📦

Path Size
./packages/core/dist/core.umd.production.min.js 1.42 KB (0%)
./packages/immer/dist/immer.umd.production.min.js 143 B (0%)
./packages/loading/dist/loading.umd.production.min.js 706 B (+18.26% 🔺)
./packages/persist/dist/persist.umd.production.min.js 172 B (0%)
./packages/select/dist/select.umd.production.min.js 456 B (0%)
./packages/updated/dist/updated.umd.production.min.js 407 B (0%)
./packages/typed-state/dist/typed-state.umd.production.min.js 258 B (0%)

@semoal semoal force-pushed the semoal/feat-detailed-success-loading-error-plugin branch from b10cc1b to c713099 Compare August 11, 2021 17:26
@tianzhich
Copy link
Collaborator

How about 'detail' or 'details'?

examples/all-plugins-react-ts/tsconfig.json Show resolved Hide resolved
packages/loading/src/index.ts Outdated Show resolved Hide resolved
packages/loading/src/index.ts Outdated Show resolved Hide resolved
@tianzhich
Copy link
Collaborator

plz check my commits and comments @semoal.

@semoal semoal mentioned this pull request Aug 12, 2021
15 tasks
@semoal semoal changed the title feat: loading plugin returns success/error/loading feat: @rematch/loading with type: 'full' returns success/error/loading Aug 12, 2021
@semoal semoal merged commit 6992fc5 into main Aug 12, 2021
@semoal semoal deleted the semoal/feat-detailed-success-loading-error-plugin branch August 12, 2021 07:21
semoal added a commit that referenced this pull request Aug 31, 2021
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.

Suggestion: Error/success handling plugin
2 participants