Cookie value won't increment

Wappler Version : 4.2.0
Operating System : Windows 10 x64 21H1
Server Model: NodeJS
Database Type: PostgreSQL
Hosting Type: Docker

Expected behavior

Cookie value increment by one.

Actual behavior

I have cookie set as Number type and I want to increment it’s value by 1.
If I set cookie without toNumber() it just add +1 to value as a string - it becomes 1, 11, 111 etc.
If I set cookie with toNumber() on first attempt cookie sets to 1, on second - it shows error:
parser.js:798 Formatter toNumber in expression [cookies.set('random_number',cookies.data.random_number.toNumber() + 1,{})] doesn't exist for type string

How to reproduce

  1. Create cookie as a number type
  2. Add action to add to current cookie +1
Community Page
Last updated: