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

refactor: implement repeat as a normalization to reduce number of models #6002

Merged
merged 25 commits into from
Mar 17, 2020

Conversation

domoritz
Copy link
Member

@domoritz domoritz commented Mar 2, 2020

Fixes #4947

This also fixes the layer type, which incorrectly extended generic layer spec.

@domoritz domoritz requested review from arvind and kanitw March 2, 2020 01:49
@domoritz domoritz marked this pull request as ready for review March 2, 2020 02:26
@domoritz
Copy link
Member Author

domoritz commented Mar 5, 2020

Rebased to master. Looking pretty good now.

@domoritz domoritz requested a review from a team March 5, 2020 18:50
examples/compiled/geo_repeat.vg.json Outdated Show resolved Hide resolved
examples/compiled/geo_repeat.vg.json Outdated Show resolved Hide resolved
@kanitw
Copy link
Member

kanitw commented Mar 6, 2020

Let's rebase after #6026 is merged.

@kanitw kanitw added the Blocked 🕐 For issues that are blocked by other issues label Mar 6, 2020
@domoritz
Copy link
Member Author

domoritz commented Mar 6, 2020

TODO:

  • Make sure we still use the repeat config
  • Clean up extractCompositionLayout

@kanitw kanitw removed their request for review March 6, 2020 22:56
@kanitw
Copy link
Member

kanitw commented Mar 9, 2020

I think you just caused even more renames lol

@domoritz
Copy link
Member Author

domoritz commented Mar 9, 2020

I think it's only these ones, right?

Screen Shot 2020-03-08 at 18 28 00

@kanitw
Copy link
Member

kanitw commented Mar 9, 2020

I think it's only these ones, right?

IDK, because I haven't looked at them -- too many.

@domoritz
Copy link
Member Author

I looked through the generated SVGs and this looks good to me. Anything left @kanitw?

@@ -183,6 +182,7 @@
],
"signals": [
{"name": "childWidth", "value": 200},
{"name": "childHeight", "value": 200},
Copy link
Member

@kanitw kanitw Mar 10, 2020

Choose a reason for hiding this comment

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

Why does this become childHeight? Similar to many other specs. This is repeat-column, which means the height can be reasonably shared.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you see an issue in the normalized (concat) spec? The height here is just the default, no?

@kanitw
Copy link
Member

kanitw commented Mar 10, 2020

I looked through the generated SVGs and this looks good to me. Anything left @kanitw?

It'd be great to look at generated Vega too.

Just added one comment after looking at a few Vega specs.

test/compile/repeat.test.ts Outdated Show resolved Hide resolved
src/spec/map.ts Show resolved Hide resolved
src/log/message.ts Outdated Show resolved Hide resolved
src/compile/unit.ts Outdated Show resolved Hide resolved
@@ -34,12 +34,6 @@ const scaleBindings: TransformCompiler = {
const extent = {selection: selCmpt.name, field: proj.field};
scale.set('selectionExtent', extent, true);
bound.push(proj);

// Bind both x/y for diag plot of repeated views.
if (model.repeater && model.repeater.row === model.repeater.column) {
Copy link
Member

Choose a reason for hiding this comment

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

this seems problematic?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is #6000, right?

Copy link
Member

@kanitw kanitw Mar 10, 2020

Choose a reason for hiding this comment

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

Perhaps, but what's the effect of removing these lines?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's try: #6124

scripts/rename-schema.sh Show resolved Hide resolved
src/normalize/core.ts Show resolved Hide resolved
Copy link
Member

@kanitw kanitw left a comment

Choose a reason for hiding this comment

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

I'm glad to try to isolate massive diff so we can detect this small thing

@domoritz domoritz merged commit 5c0b299 into master Mar 17, 2020
@domoritz domoritz deleted the dom/repeat-macro branch March 17, 2020 22:26
return {
...spec,
spec: this.map(spec.spec, params)
data: data ?? childSpec.data, // data from child spec should have precedence
Copy link
Member

Choose a reason for hiding this comment

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

The code here doesn't really give precedence to child spec?

'child' +
(repeatValue ? `__repeat_repeat_${varName(repeatValue)}` : '') +
(rowValue ? `__repeat_row_${varName(rowValue)}` : '') +
(columnValue ? `__repeat_column_${varName(columnValue)}` : '');
Copy link
Member

Choose a reason for hiding this comment

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

The naming logic here seems wrong for nested repeat?

Existing repeatValue should be treated as prefix to the name, not inserted in the middle.

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.

Refactor Repeat as a Macro?
2 participants