Skip to content

chore(angular): log error when attempting to use reserved prop with modals and popovers - #27491

Merged
averyrousseau merged 13 commits into
mainfrom
FW-4057
May 18, 2023
Merged

averyrousseau merged 13 commits into
mainfrom
FW-4057

Conversation

@averyrousseau

@averyrousseau averyrousseau commented May 16, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: resolves #27205


What is the current behavior?

If an Angular component that makes use of ModalController or PopoverController has a property of its own named modal or popover respectively, this will collide with an internal reference to the modal/popover element and cause errors.

What is the new behavior?

The actual behavior is unchanged, but a console error is logged guiding the developer on how to fix the issue.

Does this introduce a breaking change?

  • Yes
  • No

Other information

I used the original reproduction from the issue to test. Full steps:

  1. Clone the repo: https://github.com/Asac2142/expenses
  2. Run git checkout ef95c2e80a9991fe958d628f17ecc4e862c834ef to get to the app's state from when the issue was originally posted. Observe that the component in src/app/home/create-transaction has a private prop named modal.
  3. Run npm install, then install the dev build: npm install @ionic/[email protected]
  4. Run ionic serve. Click the fab button in the lower right. Observe the console error. If you scroll down in the modal and click the Category button, this will trigger the originally-reported issue.
  5. Rename the private modal variable to something else, like _modal.
  6. Refresh the page and re-open the modal. Note that no error is logged, and the Category button can be clicked to open another modal without issue.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: angular @ionic/angular package label May 16, 2023
@averyrousseau
averyrousseau marked this pull request as ready for review May 16, 2023 19:45

@sean-perkins sean-perkins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!!

@averyrousseau
averyrousseau added this pull request to the merge queue May 18, 2023
Merged via the queue into main with commit 07f013c May 18, 2023
@averyrousseau
averyrousseau deleted the FW-4057 branch May 18, 2023 16:21
brandyscarney pushed a commit that referenced this pull request May 22, 2023
…odals and popovers (#27491)

Issue number: resolves #27205

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

If an Angular component that makes use of `ModalController` or
`PopoverController` has a property of its own named `modal` or `popover`
respectively, this will collide with an internal reference to the
modal/popover element and cause errors.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

The actual behavior is unchanged, but a console error is logged guiding
the developer on how to fix the issue.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

I used the original reproduction from the issue to test. Full steps:

1. Clone the repo: https://github.com/Asac2142/expenses
2. Run `git checkout ef95c2e80a9991fe958d628f17ecc4e862c834ef` to get to
the app's state from when the issue was originally posted. Observe that
the component in `src/app/home/create-transaction` has a private prop
named `modal`.
3. Run `npm install`, then install the dev build: `npm install
@ionic/[email protected]`
4. Run `ionic serve`. Click the fab button in the lower right. Observe
the console error. If you scroll down in the modal and click the
Category button, this will trigger the originally-reported issue.
5. Rename the private `modal` variable to something else, like `_modal`.
6. Refresh the page and re-open the modal. Note that no error is logged,
and the Category button can be clicked to open another modal without
issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Ionic does not log error when overlay class has modal/popover property

2 participants