-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: handle if meta is undefined #138
Conversation
@@ -11,14 +11,6 @@ import { __ } from "@wordpress/i18n"; | |||
import { useEffect, useState, useMemo } from "@wordpress/element"; | |||
import { store as coreStore } from "@wordpress/core-data"; | |||
|
|||
function* getPaymentOptions(enableTiers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was not used.
@@ -50,8 +42,8 @@ const SesamyPostEditor = () => { | |||
const meta = useSelect((select) => | |||
select("core/editor").getEditedPostAttribute("meta") | |||
); | |||
const tagMetaValue = meta["_sesamy_tags"].split("|"); | |||
//const sesamyTiersTaxonomy = wp.data.select('core').getEntityRecords('taxonomy', 'sesamy_passes'); | |||
const tagMetaValue = meta["_sesamy_tags"]?.split("|"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default to null if not defined.
@@ -98,11 +90,11 @@ const SesamyPostEditor = () => { | |||
}; | |||
|
|||
const setTag = (tag, included) => { | |||
var tag_array = tagMetaValue ? tagMetaValue : []; | |||
let tag_array = tagMetaValue ? tagMetaValue : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a bit cleaning aways some var's.
} | ||
} | ||
) | ||
if (!data.sesamyItemSrc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
If meta['sesamy-tags'] is undefined this would crash.