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

Allow plugins to modify routeInfo #1572

Merged
merged 3 commits into from Feb 20, 2021

Conversation

andreme
Copy link
Contributor

@andreme andreme commented Feb 19, 2021

Description

Allow plugins to modify routeInfo to for example add or modify the data that is used on a page.

Changes/Tasks

  • Call new routeInfo hook in exportRoute
  • Call new routeInfo hook in dev server for each request
  • Extract valid hooks from object, to remove extra list

Motivation and Context

#1566

Types of changes

  • Refactoring/add tests (refactoring or adding test which isn't a fix or add a feature)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have updated the documentation accordingly
  • I have updated the CHANGELOG with a summary of my changes
  • My changes have tests around them

@@ -1,39 +1,6 @@
import { getHooks, reduceHooks } from '../utils'

const supportedHooks = [
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason these ae removed? Even though they don't have a default implementation, are you certain they're not actually supported anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the entries in the array are also keys in the exported object. So I just removed the duplication. validatePlugin now takes the valid hook names from the exported object.

Copy link
Member

Choose a reason for hiding this comment

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

GitHub was collapsing those lines, so I didn't realise. This is good. Thanks :)

# Conflicts:
#	CHANGELOG.md
@SleeplessByte
Copy link
Member

(It's still a draft, but overall this is looking good to me)

@andreme andreme marked this pull request as ready for review February 20, 2021 22:01
@SleeplessByte SleeplessByte merged commit baa4852 into react-static:master Feb 20, 2021
@andreme andreme deleted the route_info_hook branch February 20, 2021 22:08
@andreme
Copy link
Contributor Author

andreme commented Feb 20, 2021

Thanks @SleeplessByte

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.

None yet

2 participants