Skip to content

Don't delay Navie UI until IDE finished indexing - #857

Merged
jansorg merged 1 commit into
developfrom
jansorg/navie-dumbAware
Feb 11, 2025
Merged

jansorg merged 1 commit into
developfrom
jansorg/navie-dumbAware

Conversation

@jansorg

@jansorg jansorg commented Feb 10, 2025

Copy link
Copy Markdown
Contributor

Related to #848

Previously, the Navie UI was only shown when the IDE finished indexing.
Especially at startup or when libraries are indexed, this can cause a large delay between opening Navie and the time the Navie UI is displayed.

This PR fixes this problem by detecting dumb mode. Properties are refreshed after the IDE turned into smart mode.

@dividedmind dividedmind 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.

Looks good, but is there a potential race here? What if indexing finishes between setupInitMessage() and afterInit()?

@jansorg
jansorg force-pushed the jansorg/navie-dumbAware branch from 3c1d532 to 0d61da3 Compare February 11, 2025 11:45
@jansorg

jansorg commented Feb 11, 2025

Copy link
Copy Markdown
Contributor Author

@dividedmind You're right, this could happen. I've made a change to fix it.

@jansorg
jansorg requested a review from dividedmind February 11, 2025 11:46
@dividedmind

Copy link
Copy Markdown
Contributor

@dividedmind You're right, this could happen. I've made a change to fix it.

I'm not sure I understand how the change fixes it. Is the following sequence possible?

  • DumbService.isDumb(project) -> updatableNavieData = new UpdatableNavieData(false, List.of());
  • DumbService.exitDumbMode() (subscription not set up yet, data not updated)
  • afterInit() -> busConnection.subscribe() (it's too late to catch the transition above so the data will never be updated)

@jansorg
jansorg force-pushed the jansorg/navie-dumbAware branch from 0d61da3 to 8e1d100 Compare February 11, 2025 13:05
@jansorg
jansorg force-pushed the jansorg/navie-dumbAware branch from 8e1d100 to 21f1145 Compare February 11, 2025 13:09
@jansorg

jansorg commented Feb 11, 2025

Copy link
Copy Markdown
Contributor Author

@dividedmind You're right, this could happen. I've made a change to fix it.

I'm not sure I understand how the change fixes it. Is the following sequence possible?

  • DumbService.isDumb(project) -> updatableNavieData = new UpdatableNavieData(false, List.of());
  • DumbService.exitDumbMode() (subscription not set up yet, data not updated)
  • afterInit() -> busConnection.subscribe() (it's too late to catch the transition above so the data will never be updated)

I was too quick when I read your first comment and fixed another possible race, but not the one you mentioned.

I started to change the code to install the listener before the data is retrieved.
But this is problematic because it could trigger an update while the panel is still being initialized, i.e. it could interfere with the init. A better fix would be to trigger updateNaviePropertiesAlarm after the init finished, but this would introduce a delay due to the debouncing and Navie would not have up-to-date data when it's displayed for the first time.

I'd ignore this potential race because the solutions I can think of would make it worse.
WDYT?

@dividedmind dividedmind 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.

Yeah, you're probably right, this is too much of an edge case to worry about and spend much effort. Just please add a comment about this for posterity.

@jansorg
jansorg merged commit c85c0a1 into develop Feb 11, 2025
@jansorg
jansorg deleted the jansorg/navie-dumbAware branch February 11, 2025 14:20
@appland-release

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.78.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants