FLUID-5834: Error received when an ajax call back sets a model value on a component that has been destroyed

Metadata

Source
FLUID-5834
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Cindy Li
Created
2015-12-18T12:41:01.055-0500
Updated
2024-07-22T10:35:25.142-0400
Versions
  1. 1.5.1
Fixed Versions
  1. 3.0
Component
  1. IoC Testing Framework

Description

This issue can be re-produced by running the unit test - https://github.com/cindyli/universal/blob/GPII-1245-demoFLUID5834/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/webTests/components/privacySettings/html/PrivacySettingsWithPrefs-test.html

The test fails with the error:
ASSERTION FAILED: Cannot resolve reference {arguments}.0 from component { typeName: "gpii.oauth2.editPrivacySettings" gradeNames: ["gpii.oauth2.editPrivacySettings","gpii.oauth2.privacySettingsDialog","fluid.rendererRelayComponent","fluid.commonRendererComponent","fluid.viewRelayComponent","fluid.commonViewComponent","fluid.standardRelayComponent","fluid.modelRelayComponent","fluid.commonModelComponent"] id: 7hpazkn5-307} which has been destroyed

The cause was because a couple of ajax calls set model values in their call back functions to the component, such as here: https://github.com/cindyli/universal/blob/GPII-1245-demoFLUID5834/gpii/node_modules/gpii-oauth2/gpii-oauth2-authz-server/public/src/components/privacySettings/js/PrivacySettingsDialog.js. However, at then, the component itself has been destroyed by the IoC testing framework.

The work around is to use fluid.isDestroyed() to check the existence of the component before setting model values.

Environments

Firefox, Chrome. Didn't test with Safari and IE

Comments