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

NETOBSERV-783 multiple page loads with quick filters #273

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Jan 23, 2023

This fix avoid tick being called multiple times at start.

Code changes:

  • merged config / forcedFilters useEffect
  • use null when forcedFilters are disabled to differenciate with undefined
  • initState as string array to let developpers better understand what has been done, in which order and allow future states
  • log error if tick is wrongly called

@openshift-ci
Copy link

openshift-ci bot commented Jan 23, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jpinsonneau by writing /assign @jpinsonneau in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -49,7 +49,7 @@ class NetflowTrafficParent extends React.Component<Props, State> {
return this.props.children;
}
// else render default NetworkTraffic
return <NetflowTraffic />;
return <NetflowTraffic forcedFilters={null} />;
Copy link
Member

Choose a reason for hiding this comment

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

why do we need a distinction null vs undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Coming from netflow-tab, the prop will be undefined before being set.

As we force null in netflow-traffic-parent, we make the distinction between the loading state from tabs and the null state from page to skip a tick before confing loaded

// skip tick while forcedFilters & config are not loaded
// this check ensure tick will not be called during init
// as it's difficult to manage react state changes
if (!initState.current.includes('forcedFiltersLoaded') || !initState.current.includes('configLoaded')) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to have a union type for initState such as array of 'forcedFiltersLoaded' | 'configLoaded' | ... (e.g. to avoid typos)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@memodi
Copy link
Contributor

memodi commented Jan 23, 2023

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 23, 2023
@github-actions
Copy link

New image: ["quay.io/netobserv/network-observability-console-plugin:6927299"]. It will expire after two weeks.

@memodi
Copy link
Contributor

memodi commented Jan 23, 2023

@jpinsonneau - I see the "default" quick filters are not coming selected with this image, is that intentional?

@memodi
Copy link
Contributor

memodi commented Jan 23, 2023

I can confirm stability of tests have improved vastly with this change, where it loads page only once, currently without default quick filters - I am not sure if we should have kept page load with default quick filters instead?

@jpinsonneau
Copy link
Contributor Author

I can confirm stability of tests have improved vastly with this change, where it loads page only once, currently without default quick filters - I am not sure if we should have kept page load with default quick filters instead?

Good catch @memodi ! That was not intentionnal.
I'm trying to restore that right now

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 24, 2023
@jpinsonneau
Copy link
Contributor Author

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 24, 2023
@github-actions
Copy link

New image: ["quay.io/netobserv/network-observability-console-plugin:c3325a5"]. It will expire after two weeks.

@jpinsonneau
Copy link
Contributor Author

New image: ["quay.io/netobserv/network-observability-console-plugin:c3325a5"]. It will expire after two weeks.

This image works for default filters at first start on my side 🥳

@memodi
Copy link
Contributor

memodi commented Jan 30, 2023

/qe-approved

@jpinsonneau
Copy link
Contributor Author

/approve

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 31, 2023
@jpinsonneau
Copy link
Contributor Author

no changes, just fixed merge conflict

@jotak jotak merged commit 9650df2 into netobserv:main Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants