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

Add documentation page "Writing Custom Middleware" #4498

Merged

Conversation

dbartholomae
Copy link
Contributor

Fixes #4472


name: 📖 New/Updated Documentation Content
about: Adding a new docs page, or updating content in an existing docs page

PR Type

Add a page

Checklist

What docs page is being added or updated?

  • Section: Usage Guide/Using Redux/Redux Logic and Patterns
  • Page: Writing Custom Middleware

For Adding New Content

What kind of content category is this page (tutorial, how-to, explanation, reference)?

How-to

Who is the intended target audience?

Developers thinking about writing their own middleware with low to medium experience with Redux.

What knowledge are we assuming they have?

How to use Redux and middleware in general, but not how to write middleware.

What are the intended results or takeaways from reading this page?

  • Understanding what middleware can do
  • Understanding when to write custom middleware vs. using existing packages
  • Understanding how to write middleware that is compatible with other Redux middleware like RTK Query middleware

What is the most critical info they should learn?

  • That they most likely shouldn't write custom middleware

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 8, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d4c651c:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration

@netlify
Copy link

netlify bot commented Mar 8, 2023

Deploy Preview for redux-docs ready!

Name Link
🔨 Latest commit d4c651c
🔍 Latest deploy log https://app.netlify.com/sites/redux-docs/deploys/642947267570050008faa1c3
😎 Deploy Preview https://deploy-preview-4498--redux-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@markerikson markerikson left a comment

Choose a reason for hiding this comment

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

Great work! Left some requests for tweaks

docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
dbartholomae and others added 5 commits March 9, 2023 04:49
Co-authored-by: Mark Erikson <mark@isquaredsoftware.com>
Co-authored-by: Mark Erikson <mark@isquaredsoftware.com>
Co-authored-by: Mark Erikson <mark@isquaredsoftware.com>
Co-authored-by: Mark Erikson <mark@isquaredsoftware.com>
Co-authored-by: Mark Erikson <mark@isquaredsoftware.com>
Copy link
Contributor Author

@dbartholomae dbartholomae left a comment

Choose a reason for hiding this comment

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

I've fixed most of these. Open questions are

  • how to name the pattern of a middleware modifying its return value
  • whether to use the void convention for unawaited promises

docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
docs/usage/WritingCustomMiddleware.md Outdated Show resolved Hide resolved
@dbartholomae
Copy link
Contributor Author

@markerikson do you have feedback for the last two questions?

@markerikson
Copy link
Contributor

Per the "naming" question, I think I'd just refer to it as "overriding" or "replacing" the return value.

@dbartholomae
Copy link
Contributor Author

@markerikson I've rewritten the standard examples with concrete examples from rtk.

@dbartholomae
Copy link
Contributor Author

@markerikson any feedback?

@markerikson
Copy link
Contributor

Okay, let's go with this. Thanks!

@markerikson markerikson merged commit 3063535 into reduxjs:master Apr 23, 2023
9 checks passed
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.

Share expectations/best practices for Redux middleware
2 participants