This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Fix update props and connectWpPost slug entity resolution #49
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
60d2812
Fix update props
sdgluck efcbbd6
Merge branch 'master' into fix-update-props
sdgluck 4ae3566
Fix connectWpPost entity resolution by slug
sdgluck 907bba9
Merge branch 'fix-update-props' of https://github.com/outlandishideas…
sdgluck ed7e83a
patch
sdgluck a465d42
Merge branch 'master' into fix-update-props
sdgluck dc16d03
Correct post name
sdgluck 07fb507
Merge branch 'fix-update-props' of https://github.com/outlandishideas…
sdgluck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* global jest:false */ | ||
|
||
jest.disableAutomock() | ||
|
||
import React, { Component } from 'react' | ||
|
||
import { ContentTypes } from '../../../src/constants' | ||
import { connectWpPost } from '../../../src/connect' | ||
|
||
export const target = class extends Component { | ||
render () { | ||
const { query, post } = this.props.kasia | ||
if (!query.complete || !query.OK) return <div>Loading...</div> | ||
return <div>{post.title.rendered}</div> | ||
} | ||
} | ||
|
||
export default connectWpPost( | ||
ContentTypes.Post, | ||
'architecto-enim-omnis-repellendus' | ||
)(target) |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed earlier, can't we use the result of the query to know which ID(s) were returned, and then look them up in the entities array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some content types, e.g. tag, don't have an
id
so for these types we fall back on theirslug
, and vice versa. Maybe there's a better way still?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is part of
KasiaConnectWpPostComponent
, so won't the data always be a post, so have an id?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, no, sorry... confusingly post is synonymous with content type here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't realise that. In that case, this should do until (unless) we find a better solution