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

[CLEANUP] Remove deprecated auto-location #20406

Merged
merged 1 commit into from Mar 20, 2023
Merged

Conversation

chriskrycho
Copy link
Contributor

Current status: in progress and needs someone else to wrap it up. This gets most of the way there, but needs the last few pieces pulled across the line. cc. @sandstrom – if you have bandwidth to drive this, please say so! I would like to have finished it, but work has been 🔥 for this whole quarter.

@sandstrom
Copy link
Contributor

@chriskrycho If you have specific questions, or specific tasks, I can see if I may be able to tackle them, if they aren't too much work.

So for example, what parts are remaining?

Also, I've never written Typescript, I guess I can delete typescript 😄 but writing the code is a bit of a hurdle for me.

@chriskrycho
Copy link
Contributor Author

I have, unfortunately, completely lost the thread on "what is remaining" from when I started on this many weeks ago. 😩

@chriskrycho
Copy link
Contributor Author

@sandstrom I was able to pick this back up and work on it a bit, and hit a thing which is not specified in the RFC: the exported Location from @ember/routing/location is now completely empty—it is literally just an empty object with nothing on it!—so it's not clear to me what (if anything!) you expected to keep that around for. I think it's fine if we drop it and make it a type-only export which just names the interface which implementations have to conform to, but we should update the RFC with that as "learned during implementation" if that makes sense to you as a path forward. (I think that's more or less what we have to do here, as the remaining object is completely useless, but I wanted to run it by you first!)

Replace `Location` object with an interface. We no longer need the
object (it does not do anything) and in fact exporting it would just
troll people. However, we *do* need the interface internally, and it is
useful to allow people to name the 'any Location type' type, so export
that in its place.

Along the way, delete a test which prevented the DI registry type from
working correctly in Ember's internals, and simplify a few of the type
lookups there.
@chriskrycho chriskrycho merged commit 76e069a into master Mar 20, 2023
15 checks passed
@chriskrycho chriskrycho deleted the goodbye-autolocation branch March 20, 2023 23:32
expectTypeOf<Location['replaceURL']>().toEqualTypeOf<((url: string) => void) | undefined>();
expectTypeOf<Location['onUpdateURL']>().toEqualTypeOf<(callback: (url: string) => void) => void>();
expectTypeOf<Location['formatURL']>().toEqualTypeOf<(url: string) => string>();
expectTypeOf<Location['detect']>().toEqualTypeOf<(() => void) | undefined>();
Copy link
Contributor

@sandstrom sandstrom Mar 21, 2023

Choose a reason for hiding this comment

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

I think we should remove detect too.

It was mentioned in the RFC (https://github.com/emberjs/rfcs/blob/master/text/0711-deprecate-auto-location.md#what-to-deprecate-and-later-remove) and it isn't used anywhere in the codebase, afaik.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I missed that! Excellent.

* location needs to redirect to a different URL, it can cancel routing by
* setting the cancelRouterSetup property on itself to false.
*/
detect?(): void;
Copy link
Contributor

Choose a reason for hiding this comment

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

detect can be removed. See the other comment.

* @type String
* @public
*/
implementation: keyof Registry & string;
Copy link
Contributor

@sandstrom sandstrom Mar 21, 2023

Choose a reason for hiding this comment

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

Don't think this is used for anything and should be removed.

The registry will be used to store different implementations, but the instances themselves doesn't need to know their implementation name. I think this is a remnant from ages ago, before ember had a registry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks – I'll double check it!

@sandstrom
Copy link
Contributor

the exported Location from @ember/routing/location is now completely empty [...] I think it's fine if we drop it and make it a type-only export which just names the interface which implementations have to conform to

Sounds like a good idea!


I've added a few other comments above.

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.

None yet

2 participants