зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1478563 - Re-use function objects in MeatballMenu; r=jdescottes
To avoid needless re-renders due to props changing object identity. Differential Revision: https://phabricator.services.mozilla.com/D2641 --HG-- extra : rebase_source : 8635d8b0365c36fff73ec6eb5d934578185d70c0
This commit is contained in:
Родитель
7189d82c59
Коммит
74298abd28
|
@ -17,6 +17,18 @@ const { hr } = dom;
|
||||||
const { openDocLink } = require("devtools/client/shared/link");
|
const { openDocLink } = require("devtools/client/shared/link");
|
||||||
const { assert } = require("devtools/shared/DevToolsUtils");
|
const { assert } = require("devtools/shared/DevToolsUtils");
|
||||||
|
|
||||||
|
const openDevToolsDocsLink = () => {
|
||||||
|
openDocLink(
|
||||||
|
"https://developer.mozilla.org/docs/Tools?utm_source=devtools&utm_medium=tabbar-menu"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const openCommunityLink = () => {
|
||||||
|
openDocLink(
|
||||||
|
"https://discourse.mozilla.org/c/devtools?utm_source=devtools&utm_medium=tabbar-menu"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
class MeatballMenu extends PureComponent {
|
class MeatballMenu extends PureComponent {
|
||||||
static get propTypes() {
|
static get propTypes() {
|
||||||
return {
|
return {
|
||||||
|
@ -125,7 +137,7 @@ class MeatballMenu extends PureComponent {
|
||||||
id: `toolbox-meatball-menu-dock-${hostType.position}`,
|
id: `toolbox-meatball-menu-dock-${hostType.position}`,
|
||||||
key: `dock-${hostType.position}`,
|
key: `dock-${hostType.position}`,
|
||||||
label: this.props.L10N.getStr(l10nkey),
|
label: this.props.L10N.getStr(l10nkey),
|
||||||
onClick: () => hostType.switchHost(),
|
onClick: hostType.switchHost,
|
||||||
checked: hostType.position === this.props.currentHostType,
|
checked: hostType.position === this.props.currentHostType,
|
||||||
className: "iconic",
|
className: "iconic",
|
||||||
})
|
})
|
||||||
|
@ -180,7 +192,7 @@ class MeatballMenu extends PureComponent {
|
||||||
key: "settings",
|
key: "settings",
|
||||||
label: this.props.L10N.getStr("toolbox.meatballMenu.settings.label"),
|
label: this.props.L10N.getStr("toolbox.meatballMenu.settings.label"),
|
||||||
accelerator: this.props.L10N.getStr("toolbox.help.key"),
|
accelerator: this.props.L10N.getStr("toolbox.help.key"),
|
||||||
onClick: () => this.props.toggleOptions(),
|
onClick: this.props.toggleOptions,
|
||||||
className: "iconic",
|
className: "iconic",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -195,11 +207,7 @@ class MeatballMenu extends PureComponent {
|
||||||
label: this.props.L10N.getStr(
|
label: this.props.L10N.getStr(
|
||||||
"toolbox.meatballMenu.documentation.label"
|
"toolbox.meatballMenu.documentation.label"
|
||||||
),
|
),
|
||||||
onClick: () => {
|
onClick: openDevToolsDocsLink,
|
||||||
openDocLink(
|
|
||||||
"https://developer.mozilla.org/docs/Tools?utm_source=devtools&utm_medium=tabbar-menu"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -209,11 +217,7 @@ class MeatballMenu extends PureComponent {
|
||||||
id: "toolbox-meatball-menu-community",
|
id: "toolbox-meatball-menu-community",
|
||||||
key: "community",
|
key: "community",
|
||||||
label: this.props.L10N.getStr("toolbox.meatballMenu.community.label"),
|
label: this.props.L10N.getStr("toolbox.meatballMenu.community.label"),
|
||||||
onClick: () => {
|
onClick: openCommunityLink,
|
||||||
openDocLink(
|
|
||||||
"https://discourse.mozilla.org/c/devtools?utm_source=devtools&utm_medium=tabbar-menu"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче