Barista: [Expandable Section] 布尔强制无法对“expanded”属性正常工作

创建于 2020-08-10  ·  13评论  ·  资料来源: dynatrace-oss/barista

错误报告

你好团队! 似乎expanded属性不适用于强制,但如果设置为: [expanded]="true"则可以正常工作。 这很长时间运行良好,但最近停止工作并阻止我的一个生产页面正确呈现: https :

预期行为

我希望以下内容能像往常一样工作:
<dt-expandable-section expanded>

当前行为

TypeError: Cannot set property 'expanded' of undefined
    at DtExpandableSection.set expanded [as expanded] (dynatrace-barista-components-expandable-section.js:79)
    at Object.ngOnChangesSetInput [as setInput] (core.js:26879)
    at setInputsFromAttrs (core.js:13039)
    at instantiateAllDirectives (core.js:12752)
    at createDirectivesInstances (core.js:11989)
    at Module.ɵɵelementStart (core.js:21043)
    at AppComponent_Template (app.component.html:1)
    at executeTemplate (core.js:11949)
    at renderView (core.js:11735)
    at renderComponent (core.js:13244)

可能的解决方案

<dt-expandable-section [expanded]="true">

重现步骤

克隆: https :

二手版本:

  • @dynatrace/barista-components :7.6.0

非常感谢您的辛勤工作!

bug has-pr

最有用的评论

@lukasholzer按照您帖子中所述的命令,我将能够毫无问题地运行该项目

所有13条评论

@areknow非常感谢你报告这个,但我无法在 stackblitz 中重现这个
https://stackblitz.com/edit/github-yp9pwy?file=src/expandable -section/expandable-section-default-example/expandable-section-default-example.html

此外,当我查看代码时,使用了coerceBooleanProperty 。 🤔

您确定正确使用组件吗?

https://github.com/dynatrace-oss/barista/blob/master/libs/barista-components/expandable-section/src/expandable-section.ts#L76

  @Input()
  get expanded(): boolean {
    return this._panel.expanded;
  }
  set expanded(value: boolean) {
    this._panel.expanded = coerceBooleanProperty(value);
    this._changeDetectorRef.markForCheck();
  }

嗨@lukasholzer! 我也无法在 stackblitz 中重现,所以我创建了一个最小的 repo。 这可能表明 ivy 存在视图渲染器未发生的问题。 您是否能够克隆存储库并查看控制台错误?

你好@lukasholzer
我还可以使用指令的速记符号重现该问题。

@areknow您能否尝试在您的应用中使用可扩展的材料并比较其行为。 我很好奇我们是否有一些常春藤兼容性的编译问题。 这将是一个最小的设置https://stackblitz.com/edit/angular-rubmxc?file=src/app/expansion -steps-example.html

@areknow我克隆了你的 repo 做了一个 npm 安装,现在一个 ng 服务:

image

除此之外,请更新highcharts版本并删除@types/highcharts

@ffriedl89我导入了MatExpansionModule并将组件标记添加到项目中,它使用速记指令符号运行得非常好。
Screen Shot 2020-08-12 at 9 43 20 AM

@lukasholzer我删除了@types/highcharts并将highcharts更新

core.js:6185 ERROR TypeError: Cannot set property 'expanded' of undefined
    at DtExpandableSection.set expanded [as expanded] (dynatrace-barista-components-expandable-section.js:79)
    at Object.ngOnChangesSetInput [as setInput] (core.js:26879)
    at setInputsFromAttrs (core.js:13039)
    at instantiateAllDirectives (core.js:12752)
    at createDirectivesInstances (core.js:11989)
    at Module.ɵɵelementStart (core.js:21043)
    at AppComponent_Template (app.component.html:1)
    at executeTemplate (core.js:11949)
    at renderView (core.js:11735)
    at renderComponent (core.js:13244)

@areknow我把不可复制的标签放在上面,因为当我想为应用程序提供服务时看到上面的错误。 所以我无法为应用程序提供服务。

让你的回购为我运行是不可能的。

我做的步骤:

  1. git clone ...
  2. npm install
  3. ng serve

@lukasholzer我已经在三台不同的机器上运行了 repo。 不知道是什么问题,这是一个超级基础的项目🤔
@josecolella @toddbaert也运行了 repo 并看到了同样的问题。

~/Desktop/test
❯ git clone https://github.com/areknow/a-expandable-section-demo.git .
Cloning into '.'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 47 (delta 10), reused 45 (delta 8), pack-reused 0
Unpacking objects: 100% (47/47), done.

~/Desktop/test master
❯ ls
README.md          angular.json       browserslist       e2e                karma.conf.js      package-lock.json  package.json       src                tsconfig.app.json  tsconfig.json      tsconfig.spec.json tslint.json

~/Desktop/test master
❯ npm i

> [email protected] install /Users/arnaud.crowther/Desktop/test/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/arnaud.crowther/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/Users/arnaud.crowther/.nvm/versions/node/v12.16.1/bin/node" "/Users/arnaud.crowther/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/arnaud.crowther/Desktop/test/node_modules/watchpack-chokidar2/node_modules/fsevents
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

> [email protected] install /Users/arnaud.crowther/Desktop/test/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/arnaud.crowther/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/Users/arnaud.crowther/.nvm/versions/node/v12.16.1/bin/node" "/Users/arnaud.crowther/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/arnaud.crowther/Desktop/test/node_modules/webpack-dev-server/node_modules/fsevents
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

> [email protected] postinstall /Users/arnaud.crowther/Desktop/test/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> @angular/[email protected] postinstall /Users/arnaud.crowther/Desktop/test/node_modules/@angular/cli
> node ./bin/postinstall/script.js

added 1391 packages from 1132 contributors and audited 1393 packages in 20.393s

41 packages are looking for funding
  run `npm fund` for details

found 5 vulnerabilities (3 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details

~/Desktop/test master 22s
❯ ng serve
0% compiling
Compiling @angular/core : es2015 as esm2015

Compiling @angular/common : es2015 as esm2015

Compiling @angular/platform-browser : es2015 as esm2015

Compiling @angular/platform-browser-dynamic : es2015 as esm2015

Compiling @angular/common/http : es2015 as esm2015

Compiling @angular/cdk/platform : es2015 as esm2015

Compiling @angular/cdk/bidi : es2015 as esm2015

Compiling @angular/cdk/collections : es2015 as esm2015

Compiling @angular/cdk/scrolling : es2015 as esm2015

Compiling @angular/cdk/keycodes : es2015 as esm2015

Compiling @angular/cdk/observers : es2015 as esm2015

Compiling @angular/cdk/a11y : es2015 as esm2015

Compiling @angular/cdk/tree : es2015 as esm2015

Compiling @angular/animations : es2015 as esm2015

Compiling @angular/forms : es2015 as esm2015

Compiling @angular/cdk/portal : es2015 as esm2015

Compiling @angular/cdk/overlay : es2015 as esm2015

Compiling @dynatrace/barista-components/core : es2015 as esm2015

Compiling @dynatrace/barista-components/icon : es2015 as esm2015

Compiling @angular/animations/browser : es2015 as esm2015

Compiling @angular/platform-browser/animations : es2015 as esm2015

Compiling @angular/cdk/table : es2015 as esm2015

Compiling @angular/cdk/drag-drop : es2015 as esm2015

Compiling @dynatrace/barista-components/button : es2015 as esm2015

Compiling @dynatrace/barista-components/indicator : es2015 as esm2015

Compiling @dynatrace/barista-components/empty-state : es2015 as esm2015

Compiling @dynatrace/barista-components/form-field : es2015 as esm2015

Compiling @dynatrace/barista-components/formatters : es2015 as esm2015

Compiling @angular/cdk/text-field : es2015 as esm2015

Compiling @dynatrace/barista-components/input : es2015 as esm2015

Compiling @dynatrace/barista-components/checkbox : es2015 as esm2015

Compiling @dynatrace/barista-components/pagination : es2015 as esm2015

Compiling @dynatrace/barista-components/table : es2015 as esm2015

Compiling @dynatrace/barista-components/expandable-panel : es2015 as esm2015

Compiling @dynatrace/barista-components/expandable-section : es2015 as esm2015

Compiling @angular/cdk/accordion : es2015 as esm2015

Compiling @angular/material/expansion : es2015 as esm2015

chunk {main} main.js, main.js.map (main) 14 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 150 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 108 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.99 MB [initial] [rendered]
Date: 2020-08-12T15:43:23.068Z - Hash: 1ecde4c6e7201f777336 - Time: 57275ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.

Date: 2020-08-12T15:43:24.031Z - Hash: 1ecde4c6e7201f777336
5 unchanged chunks

Time: 537ms
: Compiled successfully.

@lukasholzer按照您帖子中所述的命令,我将能够毫无问题地运行该项目

@lukasholzer我也能够通过成功的编译消息重现该问题。

  1. 克隆的 git 仓库
  2. 安装
  3. 服务

结果:
Screen Shot 2020-08-12 at 12 03 13 PM
Screen Shot 2020-08-12 at 12 03 07 PM
Screen Shot 2020-08-12 at 12 02 47 PM
Screen Shot 2020-08-12 at 11 57 00 AM

@areknow@thomaspink和我自己发现了我们将解决的问题! :) 想知道即使在 VE 中这如何工作,因为我们试图在setter上设置一个属性,这是一个 viewChild 所以后来的生命周期。 🤔

这对您来说是一个紧急修复,还是您可以通过 8.0.0 获得它,否则我们必须为此问题进行反向移植。

由 PR #1491 修复

@lukasholzer 那是个好消息! 我对我的应用程序进行了热修复,所以我可以等到 8.0.0。 谢谢!

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

ffriedl89 picture ffriedl89  ·  8评论

lukasholzer picture lukasholzer  ·  8评论

beeme1mr picture beeme1mr  ·  7评论

Sherif-Elhefnawy picture Sherif-Elhefnawy  ·  3评论

TannerGilbert picture TannerGilbert  ·  4评论