Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Interface updates #681

Merged
merged 2 commits into from
Sep 17, 2017
Merged

Interface updates #681

merged 2 commits into from
Sep 17, 2017

Conversation

bitpshr
Copy link
Member

@bitpshr bitpshr commented Sep 14, 2017

Type: feature

The following has been addressed in the PR:

  • There is a related issue
  • All code matches the style guide
  • Unit or Functional tests are included in the PR

Description:

This PR updates the WidgetProperties interface so that key can be a number or a string. A new KeyedWidgetProperties interface was also added that extends WidgetProperties and makes key required.

Resolves #672

src/meta/Base.ts Outdated
const node = this.nodeHandler.get(key);

if (!node && !this._requestedNodeKeys.has(key)) {
const handle = this.nodeHandler.on(key, () => {
const handle = this.nodeHandler.on(key as string, () => {
Copy link
Member

@agubler agubler Sep 14, 2017

Choose a reason for hiding this comment

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

Do you think that we should actually convert this to a string, instead of casting the TS type?

`${key}`

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, better than assuming there is some sort of implicit coercion of numbers downstream.

@@ -156,7 +155,7 @@ export class WidgetBase<P = WidgetProperties, C extends DNode = DNode> extends E
/**
* cached chldren map for instance management
*/
private _cachedChildrenMap: Map<RegistryLabel | Promise<WidgetBaseConstructor> | WidgetBaseConstructor, WidgetCacheWrapper[]>;
private _cachedChildrenMap: Map<string | number | Promise<WidgetBaseConstructor> | WidgetBaseConstructor, WidgetCacheWrapper[]>;
Copy link
Member

Choose a reason for hiding this comment

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

Why is it not RegistryLabel | number |...?

Copy link
Member

Choose a reason for hiding this comment

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

It actually should never have been registry label, the map always takes the key from properties and uses that (or the widget constructor). So I think it wasn't correct to support symbols.

Copy link
Member

Choose a reason for hiding this comment

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

👍 cool...

Copy link
Contributor

@matt-gadd matt-gadd left a comment

Choose a reason for hiding this comment

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

whoops wrong pr

@bitpshr
Copy link
Member Author

bitpshr commented Sep 15, 2017

@agubler @kitsonk this should be ready for another review. Thanks!

@bitpshr bitpshr merged commit e3da78b into dojo:master Sep 17, 2017
@bitpshr bitpshr deleted the widget-properties branch September 17, 2017 19:04
@dylans dylans added this to the 2017.09 milestone Sep 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants