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

Delete Grid component #1785

Merged
merged 2 commits into from
Oct 11, 2019
Merged

Delete Grid component #1785

merged 2 commits into from
Oct 11, 2019

Conversation

nstepien
Copy link
Contributor

Grid is an unnecessary component layer, so I've moved its stuff into the root component.

@nstepien nstepien requested a review from amanmahajan7 October 10, 2019 19:50
@nstepien nstepien self-assigned this Oct 10, 2019
import { GridProps } from './Grid';
import { CalculatedColumn, Position, ScrollPosition, SubRowDetails, RowRenderer, RowRendererProps, RowData, ColumnMetrics, CellMetaData, InteractionMasksMetaData } from './common/types';
import { ReactDataGridProps } from './ReactDataGrid';
import EventBus from './EventBus';
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a general discussion regarding this EventBus, looks like it can be replaced by Context now? After several layers being removed, we directly render the Canvas in RDG.tsx in this PR, it seems we start to not need the eventBus 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.

How would you use a context to trigger scrollToColumn?

Copy link
Contributor

Choose a reason for hiding this comment

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

For scrollToColumn case, can't we move it one level up? Then we can move canvas ref in scrollToColumn in RDG level like this.

  function scrollToColumn(idx: number, columns: CalculatedColumn<R>[]) {
    const { current } = canvas.current.ref;
    ...
  }

This evenBus subscribe and unsubscribe makes me feel like we are going back and forth to avoid passing functions as props. With the layers being removed, maybe the eventBus can be removed gradually, or did I miss something?

Copy link
Contributor

@amanmahajan7 amanmahajan7 Oct 10, 2019

Choose a reason for hiding this comment

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

The idea behind event bus was to avoid rendering all the cells when a cell is clicked or selection is changed. Previously {rowidx, cellIx } was being passed to each cell and it resulted in a really slow cell navigation. That was the whole idea behind adding interaction mask

#1123

We can delete InteractionMask in the future now that we have improved rendering so much. I am sure that will make grid much simpler now

import { GridProps } from './Grid';
import { CalculatedColumn, Position, ScrollPosition, SubRowDetails, RowRenderer, RowRendererProps, RowData, ColumnMetrics, CellMetaData, InteractionMasksMetaData } from './common/types';
import { ReactDataGridProps } from './ReactDataGrid';
import EventBus from './EventBus';
Copy link
Contributor

@amanmahajan7 amanmahajan7 Oct 10, 2019

Choose a reason for hiding this comment

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

The idea behind event bus was to avoid rendering all the cells when a cell is clicked or selection is changed. Previously {rowidx, cellIx } was being passed to each cell and it resulted in a really slow cell navigation. That was the whole idea behind adding interaction mask

#1123

We can delete InteractionMask in the future now that we have improved rendering so much. I am sure that will make grid much simpler now

@amanmahajan7 amanmahajan7 merged commit f1bde02 into canary Oct 11, 2019
@amanmahajan7 amanmahajan7 deleted the ns-rm-grid branch October 11, 2019 00:22
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.

3 participants