Skip to content

State containers refactor #73

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

Merged
merged 3 commits into from
Feb 27, 2018
Merged

Conversation

chriseppstein
Copy link
Contributor

After spending considerable time exploring this new structure, I found the BlockTree abstraction mostly obfuscated the connections between core models of the Block (Block, Class, and State). By keeping the Inheritable data type and going directly to the concrete classes without an intermediate abstraction, we're still able to keep the Block types split up, but have less cognitive overhead while navigating the data model.

Since I didn't really know what I thought would be a better approach I wasn't sure exactly how to describe in a code review what to change, so I decided to refactor the code until it "felt more right".

So this is my PR to augment https://github.com/css-blocks/css-blocks/pull/71

There's still a couple failing tests and it depends on a new function in @opticss/util to work (css-blocks/opticss@3f63bf2).

After spending considerable time exploring this new structure, I found
the BlockTree abstraction mostly obfuscated the connections between
core models of the Block (Block, Class, and State). By keeping
the Inheritable data type and going directly to the concrete classes
without an intermediate abstraction, we're still able to keep the
Block types split up, but have less cognitive overhead while navigating
the data model.
never
> {
// tslint:disable-next-line:prefer-whatever-to-any
public lookup(_path: string, _errLoc?: SourceLocation | undefined): Inheritable<any, any, any, any> | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can use AnyNode here to avoid the lint disable

@amiller-gh
Copy link
Contributor

I'm happy with this! Strikes a nice middle ground between my completely abstracted approach and the realities of css-blocks' data structures.

@amiller-gh amiller-gh merged commit ca25918 into state_containers Feb 27, 2018
@amiller-gh amiller-gh deleted the state_containers_refactor branch March 2, 2018 20:17
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.

2 participants