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

Fix save event for custom groups on first navigation #101

Merged
merged 3 commits into from
Dec 25, 2023

Conversation

JadynWong
Copy link
Contributor

Fix #100

@gdlcf88 gdlcf88 requested review from wakuflair and removed request for gdlcf88 December 23, 2023 15:37
Copy link
Collaborator

@blackWins blackWins left a comment

Choose a reason for hiding this comment

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

Some code needs to be optimized

event_fn(_id);
if ($(_id + " form").length > 0) {
clearInterval(btn_set);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The else statement may not be necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it always needs to be executed. It also clear the interval when the form is found.

});

if (location.hash) {
var index = location.hash.substring(1);
$("#SettingManagementWrapper li.nav-item > a.nav-link")[index].click();
history.replaceState(null, null, ' '); // remove hash from the location url
}

// The first nav will automatically click and loading before on this script.
bind_nav_event_fn($("#SettingManagementWrapper li.nav-item > a.nav-link").first());
Copy link
Collaborator

Choose a reason for hiding this comment

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

It may be better understood to use $('#tabs-nav .nav-item .nav-link') here

var btn_set = setInterval(function () {
var _id = '#' + _this.data('id') + " ";
var _id = '#' + element.data('id') + " ";
event_fn(_id);
if ($(_id + " form").length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

When no form exists, we can consider skipping the next steps.
if ($(_id + " form").length == 0) return

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If form is not setting ui's form. We also need to clear the interval.

var btn_set = setInterval(function () {
var _id = '#' + _this.data('id') + " ";
var _id = '#' + element.data('id') + " ";
Copy link
Collaborator

@blackWins blackWins Dec 25, 2023

Choose a reason for hiding this comment

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

There's a legacy here, when we click FeatureManagement Tab $(_id + " form").length It's always 0,
So the value of id should bevar _id = '#' + element.data('id').replace(/\./g, '-') + " ";

Copy link
Collaborator

Choose a reason for hiding this comment

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

@JadynWong JadynWong requested a review from blackWins December 25, 2023 08:13
@blackWins blackWins merged commit 8bb3815 into EasyAbp:main Dec 25, 2023
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.

An exception occurred when the setting was saved
2 participants