Skip to content

Commit

Permalink
fix(#158): fix missing langcode issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed May 11, 2022
1 parent 8a8ea07 commit 17478c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ export default {
*
* @see {@link https://druxt.github.io/druxt-entity/api/components/DruxtEntity|DruxtEntity}
*/
propsData: ({ $fetchState, $store, block }) => {
propsData: ({ $fetchState, $store, block, langcode }) => {
if ($fetchState.pending) return false
const { data } = $store.state.druxt.resources[block.type][block.id]
const { data } = $store.state.druxt.resources[block.type][block.id][langcode]
if (!((data || {}).attributes || {}).dependencies) return false
const parts = data.attributes.dependencies.content[0].split(':')
return {
key: data.attributes.dependencies.content[0],
langcode: this.langcode,
langcode,
type: `${parts[0]}--${parts[1]}`,
uuid: parts[2]
}
Expand Down
4 changes: 2 additions & 2 deletions packages/druxt/src/stores/druxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ const DruxtStore = ({ store }) => {
*/
async getResource ({ commit, dispatch, state }, { type, id, query, prefix }) {
// Get the resource from the store if it's avaialble.
const storedResource = (state.resources[type] || {})[id] ?
{ ...state.resources[type][id] }
const storedResource = ((state.resources[type] || {})[id] || {})[prefix] ?
{ ...state.resources[type][id][prefix] }
: null

// Parse the query.
Expand Down

0 comments on commit 17478c8

Please sign in to comment.