Skip to content

Conversation

@PerfectPixel
Copy link
Contributor

Resolves #37

@erikras I just copied the suitable test-case and adjusted it to demonstrate the issue. Let me know if I should structure the tests differently. 👍

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #38 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #38   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          14     15    +1     
  Lines         157    159    +2     
  Branches       34     34           
=====================================
+ Hits          157    159    +2
Impacted Files Coverage Δ
src/utils.js 100% <100%> (ø)
src/removeBatch.js 100% <100%> (ø) ⬆️
src/pop.js 100% <100%> (ø) ⬆️
src/insert.js 100% <100%> (ø) ⬆️
src/remove.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ee1ef8...a6cac96. Read the comment docs.

src/utils.js Outdated
@@ -0,0 +1,3 @@
// @flow
export const escapeRegexTokens = (str: string): string =>
str.replace(/([.\-[])/g, '\\$1')
Copy link
Contributor

Choose a reason for hiding this comment

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

I've found this robust regex on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping - maybe use this one with a comment where is it taken from?

Copy link
Member

Choose a reason for hiding this comment

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

Good idea. I'll change that.

@SpOOnman
Copy link
Contributor

This solution works for me too and I've suggested even more complex regex to improve this fix.

@erikras erikras merged commit 9f8f74f into final-form:master Nov 20, 2019
@erikras
Copy link
Member

erikras commented Nov 20, 2019

Published in v3.0.2.

@SpOOnman
Copy link
Contributor

Thanks @erikras !

@PerfectPixel PerfectPixel deleted the escape-all-the-regex branch November 20, 2019 13:28
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

State-management on insert/... does not work on nested arrays

3 participants