Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert FlashObject to native class #394

Merged

Conversation

gilest
Copy link
Contributor

@gilest gilest commented Oct 23, 2023

This will be breaking due to

  • Public type declarations
  • The getFlashObject public API

To do

  • Upgrade guide -> You cannot call .get() etc on FlashObject instances
  • Update type declarations

As for these two I'm not sure what their purpose is, I couldn't find any mention of them in the docs or PRs/issues. I don't think they are public API...

  • Document on('didDestroyMessage') event -> onDidDestroyMessage callback
  • Document on('didExitMessage') event -> onDidExitMessage callback

@gilest gilest force-pushed the refactor/native-class branch 3 times, most recently from 6a85006 to f92ff84 Compare October 24, 2023 03:16
@gilest gilest mentioned this pull request Oct 27, 2023
8 tasks
@gilest gilest force-pushed the refactor/native-class branch from f92ff84 to 23cd226 Compare February 3, 2024 00:03
@@ -1,5 +1,15 @@
# Upgrading ember-cli-flash

## Upgrading to v6
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assuming next release will be v6, although minor, this is a breaking change.

Would be good to batch all the remaining internal changes and TypeScript migration in the same update...

Comment on lines +11 to +12
@tracked exiting = false;
@tracked message = '';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This this is no longer an EmberObject. Only the tracked properties will update rendered flash messages. We may want to track type as well, although I'm not sure if that would even work.

@@ -18,23 +19,29 @@ module('Integration | Component | flash message', function (hooks) {
setupRenderingTest(hooks);

test('it renders a flash message', async function (assert) {
this.set('flash', FlashMessage.create({ message: 'hi', sticky: true }));
const flash = new FlashMessage({ message: 'hi', sticky: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

does the FlashMessage need associateDestroyableChild when it's created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good idea. I've implemented this in FlashMessagesService when the messages are created

Copy link
Contributor Author

@gilest gilest left a comment

Choose a reason for hiding this comment

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

@NullVoxPopuli migrated the destruction to use @ember/destroyable. Seems to work good, there are quite a lot of tests that were checking destruction timing

@@ -11,6 +11,5 @@ declare module 'ember-cli-flash/flash/object' {
allowExit(): void;
timerTask(): void;
exitTimerTask(): void;
destroy(): void;
Copy link
Contributor Author

@gilest gilest Mar 7, 2024

Choose a reason for hiding this comment

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

This was an EmberObject method. Public API destroyMessage() will destroy the message and should be used instead.

@NullVoxPopuli NullVoxPopuli merged commit e293e0b into adopted-ember-addons:master Mar 8, 2024
10 checks passed
@github-actions github-actions bot mentioned this pull request Mar 8, 2024
@gilest gilest deleted the refactor/native-class branch March 8, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants