question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module settings view shows errors even after successfully saving settings

See original GitHub issue

Bug Description

When I successfully submitted settings, the settings preview screen keeps showing errors that had been shown during editing settings. We should reset errors for a module when settings have been saved or changes have been canceled.

Steps to reproduce

  1. Go to the Google Analytics console and create a new account.
  2. Activate the Analytics module and connect the newly created account.
  3. Go to the settings page and make sure you see your selection on the settings preview screen.
  4. Go to the Google Analytics console again and delete the newly created account.
  5. Go back to the settings page and click on the “Edit” settings button.
  6. When the settings edit form loads, you should see errors on the form because it can’t find the deleted account (see screenshot below)
  7. Select another account, property, and profile and submit changes.
  8. Now you should see the settings preview screen, but errors from the settings edit form don’t disappear.

Screenshots

sitekit 10uplabs com_wp-admin_admin php_page=googlesitekit-settings


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Module store errors should be cleared after successfully saving settings
  • Secondarily, module stores should not show duplicate error messages

Implementation Brief

Prevent duplicate error messages by filtering getErrors calls

const existingErrorMessages = [];

	return errors
		.filter( ( error ) => {
			if (
				! error?.message ||
				existingErrorMessages.includes( error.message )
			) {
				return false;
			}

			existingErrorMessages.push( error.message );

			return true;
		} )
		// Include other map methods in original file here…
  • Clear all modules/analytics errors when selecting a new account. (See: 407e36905d4b21e80eb552e45ec32195857f9851) as well as when the settings screen is closed or the new settings are submitted.

Test Coverage

  • N/A

Visual Regression Changes

  • N/A

QA Brief

  1. Go to the Google Analytics console and create a new account.
  2. Activate the Analytics module and connect the newly created account.
  3. Go to the settings page and make sure you see your selection on the settings preview screen.
  4. Go to the Google Analytics console again and delete the newly created account.
  5. Go back to the settings page and click on the “Edit” settings button.
  6. When the settings edit form loads, you should see an error on the form because it can’t find the deleted account. You shoud only see
  7. Select another account, property, and profile and submit changes.
  8. Now you should see the settings preview screen, but errors from the settings edit form don’t disappear.

Changelog entry

  • Don’t show duplicate errors when loading deleted Analytics accounts in the settings.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
wpdarrencommented, Oct 14, 2021

QA Update: ✅

Verified:

  • When you connect Analytics from an account created in the GA console, the correct details appear in settings. When you then delete the account in GA console, and go back to settings, an error appears. The account, property and view fields are empty. As per screenshot below.

image

  • When new details were selected, and you add that account, no errors reappear on the screen when it reloads in the settings overview or when editing.

image

There is an issue that a red border remains the Analytics settings but chatting with Arafat, this needs to be a separate issue.

I’ve made a note to create a new ticket for this.

1reaction
tofumattcommented, Oct 6, 2021

Selecting a new account doesn’t clear the fetch errors though, that’s part of the issue here—I think it’s because the errors are for various profiles/properties/etc.

When the account is selected not all errors are cleared and that’s why the message is still there… the only reliable solution I could find was to clear all errors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fatal error when trying to save a View with grouped filters ...
When using a grouped filter in a View that is not 'string' based, saving the view gives an "Error" page with message "InvalidArgumentException: ......
Read more >
Intellij is showing errors for dependencies even when project ...
I found the issue after a lot of trouble. The issue was that the poms of the sub projects were somehow marked as...
Read more >
How to troubleshoot errors when you save Excel workbooks
Possible reasons why documents don't save; Quick resolution; Additional resources; Detailed view of the options; Option 1: Save the workbook ...
Read more >
Troubleshooting common Maven issues | IntelliJ IDEA ...
Open Project Structure dialog and select Project from the options on the left. · Check the source language level for your project. the...
Read more >
Errors to Display: None - Settings won't save - Drupal Answers
Found it! This is my first Drupal site I'm pushing to production. I still had the following lines of code in my settings.php...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found