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

feat(runtime-html): deactivate while activating #1760

Merged

Conversation

Sayan751
Copy link
Contributor

@Sayan751 Sayan751 commented May 3, 2023

Pull Request

πŸ“– Description

This should supersede the PR #1729.

🎫 Issues

πŸ‘©β€πŸ’» Reviewer Notes

  • Take a look at the tests for the use-cases.
  • The fix seems to work for the router-lite error recovery in my branch.

πŸ“‘ Test Plan

⏭ Next Steps

@Sayan751 Sayan751 requested review from bigopon and jwx May 3, 2023 19:00
@Sayan751 Sayan751 marked this pull request as ready for review May 3, 2023 20:33
@Sayan751 Sayan751 changed the title Topic/runtime/deactivate while activating feat(runtime): deactivate while activating May 3, 2023
@Sayan751 Sayan751 changed the title feat(runtime): deactivate while activating feat(runtime-html): deactivate while activating May 3, 2023
Copy link
Member

@bigopon bigopon left a comment

Choose a reason for hiding this comment

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

Nice one @Sayan751. This covers case where we are guaranteed to exit during a phase. Will it work when there' no such guarantee? Example is when there's a long running promise returned in attaching and deactivate is call while that promise is still running? If it doesn't do that, we probably cant supersede #1729.

@Sayan751
Copy link
Contributor Author

Sayan751 commented May 4, 2023

Example is when there's a long running promise returned in attaching and deactivate is call while that promise is still running?

Good point @bigopon! I will add the tests. Thanks for the review.

@Sayan751 Sayan751 marked this pull request as draft May 4, 2023 16:57
@jwx
Copy link
Member

jwx commented May 4, 2023

Nice one @Sayan751. This covers case where we are guaranteed to exit during a phase. Will it work when there' no such guarantee? Example is when there's a long running promise returned in attaching and deactivate is call while that promise is still running? If it doesn't do that, we probably cant supersede #1729.

Yeah, I don't think this covers all use cases that #1729 covers. I'd be surprised if there's a so much easier way to solve those that it's worth searching for a different enough take than that in #1729. 🀷

@bigopon
Copy link
Member

bigopon commented May 4, 2023

Example is when there's a long running promise returned in attaching and deactivate is call while that promise is still running?

Good point @bigopon! I will add the tests. Thanks for the review.

No worries, thanks for the PR. Simplest case I can think of is attaching returns a promise that resolves in 100ms. Then a deactivate is called at 20ms. After that, there shouldn't be any attached hook invoked.

@Sayan751 Sayan751 force-pushed the topic/runtime/deactivate-while-activating branch from 66c882a to 8ff8318 Compare May 9, 2023 19:04
@Sayan751 Sayan751 marked this pull request as ready for review May 9, 2023 19:14
Copy link
Member

@bigopon bigopon left a comment

Choose a reason for hiding this comment

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

Nice work @Sayan751 A few more details to iron out for the implementation then I'll start reviewing the test πŸ‘

packages/runtime-html/src/templating/controller.ts Outdated Show resolved Hide resolved
packages/runtime-html/src/templating/controller.ts Outdated Show resolved Hide resolved
packages/testing/src/startup.ts Outdated Show resolved Hide resolved
packages/testing/src/startup.ts Outdated Show resolved Hide resolved
packages/testing/src/startup.ts Outdated Show resolved Hide resolved
packages/runtime-html/src/templating/controller.ts Outdated Show resolved Hide resolved
packages/runtime-html/src/templating/controller.ts Outdated Show resolved Hide resolved
@Sayan751 Sayan751 force-pushed the topic/runtime/deactivate-while-activating branch from 56c2bcd to 2ed4911 Compare May 13, 2023 05:00
@codecov
Copy link

codecov bot commented May 13, 2023

Codecov Report

Merging #1760 (b0c66dc) into jwx-cancel-activation (06c432a) will increase coverage by 0.17%.
The diff coverage is 94.00%.

@@                    Coverage Diff                    @@
##           jwx-cancel-activation    #1760      +/-   ##
=========================================================
+ Coverage                  87.84%   88.01%   +0.17%     
=========================================================
  Files                        242      242              
  Lines                      22592    22555      -37     
  Branches                    5177     5163      -14     
=========================================================
+ Hits                       19845    19852       +7     
+ Misses                      2747     2703      -44     
Impacted Files Coverage Ξ”
packages/runtime-html/src/templating/controller.ts 88.19% <94.00%> (+5.47%) ⬆️

... and 2 files with indirect coverage changes

πŸ“£ We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@bigopon bigopon left a comment

Choose a reason for hiding this comment

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

Nice work on the tests @Sayan751 I have some minor comments for now, will continue soon. Currently I don't agree with the form of the tests, loops are still employed and I anticipate that it's not gonna help us move forward. I'll think of a way to remove the loop and propose that in a separate PR targeting this branch.

@Sayan751
Copy link
Contributor Author

Currently I don't agree with the form of the tests, loops are still employed and I anticipate that it's not gonna help us move forward. I'll think of a way to remove the loop and propose that in a separate PR targeting this branch.

@bigopon Thanks for the review. I think if we remove the loop, the test suite will explode in size and will soon be unmanageable. I have tried to keep the loop to minimum, not to create much cognitive load.

@bigopon bigopon changed the base branch from master to jwx-cancel-activation May 16, 2023 05:46
@bigopon bigopon changed the base branch from jwx-cancel-activation to master May 16, 2023 05:48
@bigopon bigopon changed the base branch from master to jwx-cancel-activation May 16, 2023 05:48
@bigopon bigopon merged commit d1ec8ef into jwx-cancel-activation May 16, 2023
24 checks passed
@bigopon bigopon deleted the topic/runtime/deactivate-while-activating branch May 16, 2023 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants