Skip to content

fix: take into account all changed keys #231

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

Merged
merged 1 commit into from
Jun 30, 2025

Conversation

SantosVilanculos
Copy link
Contributor

Fix: Account for all changed keys in settingsStore.onDidAnyChange

This commit addresses an issue where only the first changed key was being processed when multiple settings were updated simultaneously. The previous implementation used Object.keys(newValue).find() which stops after finding the first difference.

The updated code now iterates through all keys in the newValue object and compares them to their corresponding values in oldValue. This ensures that every changed setting triggers the notifyLaravel function, providing a complete and accurate representation of settings modifications.

Specifically, this change is crucial in scenarios where:

  • clear() or reset() are called on the settings store.
  • Multiple settings are updated within a single operation.
  • The application is running in watch mode, where consistent updates are expected.

The Object.keys(newValue).filter() method now obtains all changed keys, which are each sent to the notifyLaravel to update the backend for each relevant setting.


I made the same pull request before, but deleted the fork of the repository, not knowing the side effects (this closed the pull request).

Previous pull request #210

@SRWieZ SRWieZ merged commit 861d5ef into NativePHP:main Jun 30, 2025
27 checks passed
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.

3 participants