Skip to content

Commit

Permalink
Fix small stuff in useRuleset
Browse files Browse the repository at this point in the history
  • Loading branch information
niktekusho committed May 18, 2024
1 parent 46b716e commit da3501c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/morph/react/useRuleset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function useRulesets() {
rulesetValidationResults
.filter((result): result is ValidationError => result.failed)
.forEach((error) =>
console.warn(
console.error(
"Found the following errors in the persisted rulesets:",
error
)
Expand Down Expand Up @@ -138,7 +138,7 @@ export function useRulesets() {
const localStorageValue = localStorage.getItem(rulesetsLSKey);
if (localStorageValue) {
// Since rulesets exist, we need to merge.
// In case we find any kind of validation errors, we need to stop.
// In case we find any kind of validation errors, we need to stop to prevent spreading chaos.

const existingRulesets = JSON.parse(localStorageValue);
if (!Array.isArray(existingRulesets)) {
Expand Down Expand Up @@ -172,7 +172,7 @@ export function useRulesets() {
(ruleset) => ruleset.name === currentRuleset.name
);

const mergedRulesets = [...existingRulesets];
const mergedRulesets = [...sanitizedRulesets];

// found the existing ruleset, we overwrite it
if (currentRulesetIndex >= 0) {
Expand Down

0 comments on commit da3501c

Please sign in to comment.