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

Rename blocks.query as blocks.source #1902

Merged
merged 1 commit into from
Aug 9, 2017
Merged

Conversation

aduth
Copy link
Member

@aduth aduth commented Jul 14, 2017

This pull request seeks to rename the blocks export containing sources from query to source. Previously these were referred to as matchers in documentation. The query name has caused trouble since the export is commonly destructured and contains query as an available matcher (wp.blocks.query.query), i.e.

// Before:
import { query as hpq } from 'blocks';
const { query } = hpq;

// After:
import { source } from 'blocks';
const { query } = source;

Alternative name considered was source. Open for discussion.

See also: http://gutenberg-devdoc.surge.sh/reference/attribute-sources/

Testing instructions:

There should be no functional changes with this branch.

Verify that tests pass:

npm test

@aduth aduth added the Framework Issues related to broader framework topics, especially as it relates to javascript label Jul 14, 2017
Copy link
Member

@ellatrix ellatrix left a comment

Choose a reason for hiding this comment

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

Much better. :)

@aduth aduth added this to the Beta 0.6.0 milestone Jul 14, 2017
@jasmussen
Copy link
Contributor

Should we merge? ;)

@aduth
Copy link
Member Author

aduth commented Jul 26, 2017

@jasmussen It might need a rebase in case there are new additions of the old query property, but I'm okay to merge this whenever. The issue is that this is a breaking change particularly affecting any developers who have in-progress blocks, so might be worth highlighting in change notes for the release it's included within.

@jasmussen
Copy link
Contributor

It might need a rebase in case there are new additions of the old query property, but I'm okay to merge this whenever. The issue is that this is a breaking change particularly affecting any developers who have in-progress blocks, so might be worth highlighting in change notes for the release it's included within.

I trust you completely, I didn't mean to hurry you or anything. I just saw an approved but unmerged branch with a green button, and wanted to make sure it hadn't been forgotten. My apologies, as you were!

@mtias
Copy link
Member

mtias commented Jul 27, 2017

@aduth I've been sitting on this one, and I am having a slightly bigger inclination for using source instead of matchers. What do you think?

@aduth
Copy link
Member Author

aduth commented Jul 27, 2017

I don't have a particularly strong preference either way. "source" is a little ambiguous as to whether it's as a noun or a verb (the source, to source).

Also has an impact on #1905, e.g.

// Before
{ attributes: { number: { matcher: attr( 'div', 'data-number' ) } } }

// After
{ attributes: { number: { source: attr( 'div', 'data-number' ) } } }

In that light, source is a fair bit nicer, and could potentially extend better to server-provided values.

@westonruter
Copy link
Member

I like source much more than matcher. It makes more sense to me.

@aduth
Copy link
Member Author

aduth commented Jul 28, 2017

Rebased to resolve conflicts, update new blocks, change to source.

Previously: bab0067

@aduth aduth changed the title Rename blocks.query as blocks.matchers Rename blocks.query as blocks.source Jul 28, 2017
@mtias mtias modified the milestones: Beta 0.7.0, Beta 0.6.0 Jul 28, 2017
@mtias mtias modified the milestones: Beta 0.8.0, Beta 0.7.0 Aug 7, 2017
@codecov
Copy link

codecov bot commented Aug 9, 2017

Codecov Report

Merging #1902 into master will not change coverage.
The diff coverage is 90.69%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1902   +/-   ##
=======================================
  Coverage   25.35%   25.35%           
=======================================
  Files         151      151           
  Lines        4701     4701           
  Branches      792      792           
=======================================
  Hits         1192     1192           
  Misses       2967     2967           
  Partials      542      542
Impacted Files Coverage Δ
blocks/api/paste.js 61.53% <0%> (ø) ⬆️
blocks/library/pullquote/index.js 33.33% <100%> (ø) ⬆️
blocks/library/quote/index.js 14.28% <100%> (ø) ⬆️
blocks/api/parser.js 98.03% <100%> (ø) ⬆️
blocks/library/embed/index.js 45.45% <100%> (ø) ⬆️
blocks/library/image/index.js 14.7% <100%> (ø) ⬆️
blocks/library/text-columns/index.js 33.33% <100%> (ø) ⬆️
blocks/library/freeform/index.js 100% <100%> (ø) ⬆️
blocks/library/verse/index.js 37.5% <100%> (ø) ⬆️
blocks/library/html/index.js 23.07% <100%> (ø) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a194209...a4708a1. Read the comment docs.

@aduth aduth merged commit b4dc3e0 into master Aug 9, 2017
@aduth aduth deleted the update/query-to-matchers branch August 9, 2017 13:19
@ellatrix
Copy link
Member

Hm, this broke paste. :/

ellatrix added a commit that referenced this pull request Aug 14, 2017
ellatrix added a commit that referenced this pull request Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants