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

Celest crashing when editing files #25

Closed
rubenferreira97 opened this issue Jan 31, 2024 · 14 comments
Closed

Celest crashing when editing files #25

rubenferreira97 opened this issue Jan 31, 2024 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@rubenferreira97
Copy link

rubenferreira97 commented Jan 31, 2024

Steps to reproduce:

1. Given the following code:

functions/location.dart:

Future<Location> getLocation(String name) async {
  return Location(name: name, gps: (latitude: 0.0, longitude: 0.0));
}

lib/models.dart:

typedef GPS = ({double latitude, double longitude});

class Location {
  Location({required this.name, required this.gps});
  final String name;
  GPS gps;
}

functions/location.dart:

2. Change files and Save All:

Future<Location> getLocation(String name) async {
  return Location(name: name);
}

lib/models.dart:

class Location {
  Location({required this.name});
  final String name;
}

3. See crash:

Reloading Celest...
An unexpected error occurred. A crash report has been sent to the Celest team.

This seems to happen everytime I add or remove any fields from a model.

@dnys1 dnys1 added the bug Something isn't working label Jan 31, 2024
@dnys1 dnys1 self-assigned this Jan 31, 2024
@dnys1
Copy link
Member

dnys1 commented Jan 31, 2024

Hi @rubenferreira97, sorry you are facing this issue and thanks for the detailed report.

I am taking a look and will get you an update soon. This should work, though, and I don't believe you're doing anything wrong.

@dnys1
Copy link
Member

dnys1 commented Feb 1, 2024

I've released version 0.1.8 of the CLI with a fix for this (it was a simple cache invalidation issue). You can get the latest by running celest upgrade. Sorry for the hassle and please let me know if you face this problem again or any others!

@dnys1 dnys1 closed this as completed Feb 1, 2024
@rubenferreira97
Copy link
Author

rubenferreira97 commented Feb 1, 2024

Thank you for the quick input @dnys1! This issue seems to be solved, however I think it introduced a new issue on flutter hot reload (at least this was working in previous Celest versions):

1. In flutter, change main.dart and save:

FutureBuilder(
  future: celest.functions.greeting.sayHello('Celest'), // Change 'Celest' to 'CelestA'
  builder: (_, snapshot) => switch (snapshot) {
    AsyncSnapshot(:final data?) => Text(data),
    AsyncSnapshot(:final error?) =>
      Text('${error.runtimeType}: $error'),
    _ => const CircularProgressIndicator(),
  },
),

2. App is reloaded but it still displays Hello, Celest instead of Hello, CelestA.

Sorry to bother, but I am testing this product and reporting issues because I really think it has a lot of potential!

@dnys1 dnys1 reopened this Feb 1, 2024
@dnys1
Copy link
Member

dnys1 commented Feb 1, 2024

Oh no! 😬

I will look into it now. No bother at all! The feedback tells me you care which is great 🥳 please don't stop!

@dnys1
Copy link
Member

dnys1 commented Feb 1, 2024

Okay, I added some tests now and believe it is resolved 🤞

Would you be willing to run celest upgrade again and let me know if everything is working for you, @rubenferreira97?

@rubenferreira97
Copy link
Author

Hey @dnys1, I've upgraded to Celest 0.1.9, but I'm still encountering the flutter hot reload issue. I'm using Windows and Dart 3.3.0-279.2.beta.

Do you think there might be a stale cache causing this? I managed to get it working once by creating a new project, but subsequent attempts haven't been successful.

For future improvements, could we consider allowing user input after celest start for actions such as:

  • reload: force a reload (similar to hitting save without having the IDE open),
  • invalidate: recompute cache and reload
  • etc...

Alternatively, adding more celest commands like celest clean might be helpful.

@dnys1
Copy link
Member

dnys1 commented Feb 2, 2024

Thanks for the extra information. I will continue to look into it. At the moment, I'm not able to reproduce it but I'll keep you posted as I dig more!

@dnys1
Copy link
Member

dnys1 commented Feb 2, 2024

Does hot restarting the Flutter app display the correct information?

@rubenferreira97
Copy link
Author

Hey @dnys1, each time I hot reload flutter gives me a message that my application was restarted, however the old value still appears.

After testing a bit, it seems hot reload is working, but after some time it stops working randomly.

I think I have found the problem. Each time I run celest start a bunch of dart.exe and dartaoutruntime.exe instances are created.

It seems flutter keeps connected to one of these old dart.exe instances instead of the new one.

2024.02.02-22.56_03.mp4

@rubenferreira97
Copy link
Author

Hey @dnys1, do you need me to do anything else or run any additional tests to help resolve this issue? I have upgraded to Celest version 0.1.13 and this issue still happens. No pressure, just asking!

@dnys1
Copy link
Member

dnys1 commented Feb 8, 2024

Hey @rubenferreira97, sorry for the radio silence. I haven't gotten a chance to dive in yet, but I should be able to look at it this weekend!

Sorry for the inconvenience, and thanks for the data you've sent so far!

@dnys1
Copy link
Member

dnys1 commented Feb 26, 2024

Hi @rubenferreira97, I believe this is being caused by dart-lang/sdk#49234. I will see what I can do to workaround it! Apologies for the delay and thanks for your patience.

@dnys1
Copy link
Member

dnys1 commented Feb 29, 2024

Hi @rubenferreira97, I believe I have fixed this in the latest 0.2.0 version 😃

Would you be willing to run celest upgrade and try it out?

@rubenferreira97
Copy link
Author

I also believe this is fixed! Thanks @dnys1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants