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

Table Preview Updates #1614

Merged
merged 3 commits into from
Sep 25, 2017
Merged

Table Preview Updates #1614

merged 3 commits into from
Sep 25, 2017

Conversation

themadcreator
Copy link
Contributor

Separate mutable table into its own file.
Add session local storage for saving settings.
Add reset button to revert to defaults.

@llorca
Copy link
Contributor

llorca commented Sep 25, 2017

@themadcreator does this overlap with #1603? Also instead of a reset button, what do you think about #1603 (comment)

Copy link
Contributor

@cmslewis cmslewis left a comment

Choose a reason for hiding this comment

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

Cooool. Couple things.

* Demonstrates sample usage of the table component.
*/

import { defaults } from "lodash";
Copy link
Contributor

Choose a reason for hiding this comment

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

I see lodash is only a dev dependency, but still, do we really need it for this one function? Would prefer not to pull it in if we've gone this long without it.

Alternatively, we could just cherry-pick the function we need, as mentioned in their docs:

// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
var at = require('lodash/at');
var curryN = require('lodash/fp/curryN');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not important for preview, but i'll switch it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when I switched to import * as defaults from "lodash/defaults" the types couldn't be resolved.

this.storage = session ? sessionStorage : localStorage;
}

public getWithDefaults(defs?: T): T | {} {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would prefer to call this defaults. defs means "definitions" to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

name already taken by the lodash method, but i'll come up w somethign

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, boo.

return arr.indexOf(value) >= 0;
}

const DEFAULT_STATE: IMutableTableState = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we define this below the IMutableTableState interface? Keeps the DEFAULTS definition closer to its usage in the constructor, and that order would just make more sense to me.

@blueprint-bot
Copy link

Delint. Comments

Preview: documentation | table
Coverage: core | datetime

@blueprint-bot
Copy link

Import sub module

Preview: documentation | table
Coverage: core | datetime

@cmslewis cmslewis merged commit 3865ec8 into master Sep 25, 2017
@cmslewis cmslewis deleted the bd/table-perf-11 branch September 25, 2017 22: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.

4 participants