Uh oh!
There was an error while loading. Please reload this page.
[go_router] Don't log if hierarchicalLoggingEnabled is true - #6019
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
ValentinVignal
commented
Jan 31, 2024
I would like to ask for some help with the tests here. Here is the packages/packages/go_router/lib/src/logging.dart Lines 27 to 62 in 5b48c44 My idea was to write 2 tests (both with
I first wrote this test: testWidgets(
'It should log the known routes and the initial route if debugLogDiagnostics is false',
(WidgetTester tester) async {
final_FakeStdout stdout =_FakeStdout();
IOOverrides.runZoned(
() {
finalList<String> logs =<String>[];
Logger.root.onRecord.listen(
(LogRecord event) => logs.add(event.message),
);
GoRouter(
debugLogDiagnostics:true,
routes:<RouteBase>[
GoRoute(
path:'/',
builder: (_, GoRouterState state) =>constText('home'),
),
],
);
expect(
logs,
const<String>[
'Full paths for routes:\n => /\n',
'setting initial location null'
],
);
expect(stdout.writtenObjects, isNotEmpty);
},
stdout: () => stdout,
);
},
);But Do you have any suggestion? |
…-if-hierarchical-logging-enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
…enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md
ValentinVignal
commented
Feb 26, 2024
@chunhtai Any idea how I can write a test for that? |
ValentinVignal
commented
Mar 15, 2024
Hello @chunhtai, do you have any thoughts on this? |
df6f51d to
998a25eCompare…-if-hierarchical-logging-enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md
ValentinVignal
commented
Apr 1, 2024
Hello @chunhtai@johnpryan@Hangyujin , do you have any idea/feedback for the tests? |
cedvdb
commented
Apr 2, 2024
I think you have to get someone on discord for the review |
ValentinVignal
commented
Apr 2, 2024
@cedvdb Would you know which channel I should use ? I tried hackers-routing-🛤️ , but no one answered |
hannah-hyj
commented
Apr 2, 2024
@ValentinVignal I will take a look at this PR, also @chunhtai will be back in a week |
| /// Called when this route is removed from GoRouter's route history. | ||
| /// | ||
| /// Corresponds to [GoRoute.onExit]. | ||
| FutureOr<bool> onExit(BuildContext context) => true; |
There was a problem hiding this comment.
is this from other patch? we should probably separate this out
There was a problem hiding this comment.
Oops yeah, that's a mistake. I reverted it
| // This should be the only place where the last GoRoute exit the screen. | ||
| final GoRoute lastRoute = currentConfiguration.last.route; | ||
| if (lastRoute.onExit != null && navigatorKey.currentContext != null) { | ||
| walker.buildState(_configuration, _configuration.); |
…-if-hierarchical-logging-enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md
…-if-hierarchical-logging-enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md
…-if-hierarchical-logging-enabled-is-true
ValentinVignal
commented
Apr 13, 2024
@chunhtai I refactored |
hannah-hyj
commented
Apr 24, 2024
Hi @ValentinVignal, can you bump version? |
…-if-hierarchical-logging-enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
chunhtai
commented
Apr 25, 2024
@ValentinVignal looks like the ci is still not happy |
…-if-hierarchical-logging-enabled-is-true # Conflicts: # packages/go_router/CHANGELOG.md
ValentinVignal
commented
Apr 29, 2024
@chunhtai It should be good now |
flutter/packages@87a7c51...cc47b06 2024-04-30 joonas.kerttula@codemate.com [google_maps_flutter_web] Add marker clustering support (flutter/packages#6187) 2024-04-30 joonas.kerttula@codemate.com [google_maps_flutter_android] Add marker clustering support (flutter/packages#6185) 2024-04-29 32538273+ValentinVignal@users.noreply.github.com [go_router] Don't log if `hierarchicalLoggingEnabled` is `true` (flutter/packages#6019) 2024-04-29 43054281+camsim99@users.noreply.github.com [file_selector_android] Update `LICENSE` file to include newly added licensed code (flutter/packages#6626) 2024-04-29 43054281+camsim99@users.noreply.github.com [file_selector_android] Modifies `getDirectoryPath`, `openFile`, `openFiles` to return file/directory paths instead of URIs (flutter/packages#6438) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ter#6019) Fixesflutter/flutter#139667 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
…ter#6019) Fixesflutter/flutter#139667 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
…ter#6019) Fixesflutter/flutter#139667 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
Fixesflutter/flutter#139667
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.