Skip to content

Ignore undefined traits when identifying / calling setTrait(s) or identify#168

Merged
kyle-ssg merged 7 commits intomainfrom
chores/ignore_undefined_traits
Mar 30, 2023
Merged

Ignore undefined traits when identifying / calling setTrait(s) or identify#168
kyle-ssg merged 7 commits intomainfrom
chores/ignore_undefined_traits

Conversation

@kyle-ssg
Copy link
Copy Markdown
Member

@kyle-ssg kyle-ssg commented Mar 28, 2023

Prior to this, each of the following would fail to set traits / identify https://github.com/Flagsmith/flagsmith-js-client/pull/168/files#diff-0b9b511548a3e7571b5371b6ad98facf6955df9dfa855af7107b182e04bc524bR216

flagsmith.identify("id", {createdAt:undefined})

flagsmith.setTraits({createdAt:undefined})

Now traits that have undefined values will be ignored and won't be sent to the API.

If the user has enableLogs set to true it will result in the following log:
image

  • This PR now also gitignores any compiled js/ts files
  • This PR also makes a minor modification to the middleware example

@kyle-ssg kyle-ssg linked an issue Mar 28, 2023 that may be closed by this pull request
@kyle-ssg kyle-ssg changed the title Ignore undefined traits when identifying / calling setTrait(s) Ignore undefined traits when identifying / calling setTrait(s) or identify Mar 28, 2023
@kyle-ssg kyle-ssg requested a review from matthewelwell March 29, 2023 10:49
Comment thread examples/jquery/main.js Outdated
@kyle-ssg kyle-ssg requested a review from matthewelwell March 30, 2023 17:30
@kyle-ssg kyle-ssg merged commit c22a189 into main Mar 30, 2023
@kyle-ssg kyle-ssg deleted the chores/ignore_undefined_traits branch March 30, 2023 17:38
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.

Ignore undefined traits when attempting setTrait(s)

2 participants