Conversation
679dd92 to
2444034
Compare
undefined in AuthScopes
paulomarg
left a comment
There was a problem hiding this comment.
Looks great, just had a couple of nits!
| if (typeof scopes === 'string') { | ||
| scopesArray = scopes.split(new RegExp(`${AuthScopes.SCOPE_DELIMITER}\\s*`)); | ||
| } else { | ||
| } else if (scopes) { |
There was a problem hiding this comment.
Should we be extra sure that we only process accepted types?
| } else if (scopes) { | |
| } else if (scopes !== undefined) { |
There was a problem hiding this comment.
That's a good point. Should there be an exception/error at that point if scopes is not a string, array or undefined?
There was a problem hiding this comment.
Technically, typescript would fail in that case, but javascript wouldn't. Then again, we don't check for that sort of thing in a lot of other places (and is that an excuse for not doing it here? 😅 ).
There was a problem hiding this comment.
Yeah I'm unsure what the right move is here 😅
|
This needs a good rebase and probably a bit of refactoring since we've merged #153. I'll get that taken care of so this should be in a good place soon. |
2444034 to
8bf068e
Compare
88bf9c8 to
b772364
Compare
| ## [1.2.1] - 2021-03-26 | ||
| ### Added | ||
| - Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-node-api/pull/149) | ||
| - Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-node-api/pull/169) |
There was a problem hiding this comment.
I'm a little confused - is this part of v1.2.1?
Also, I think this might be a breaking change, right? It will essentially break any apps that build sessions (which might be the case for custom session storages made prior to the change to allow objects).
Update: I actually don't think it's breaking! It's OK to not get those values in the constructor (if we make the params optional), and since the properties are all public, they can continue to be set as they were.
There was a problem hiding this comment.
Ope, sorry. My changelog got all weird after I rebased. Will fix.
There was a problem hiding this comment.
Also yes, this would be breaking. I don't think these values can be optional? They need to be there for other parts of the code that handle the Session to work, right?
There was a problem hiding this comment.
Yes, but if you call the constructor and then set the fields, that's OK too, as long as the right fields continue to be set - i.e. apps that did it 'the old way' would continue to work if the constructor doesn't break because of missing params.
753a7e8 to
65226ed
Compare
|
Any updates on this one? |
|
Any update or a workaround for now? |
|
@thecodepixi Any chance you can resolve those conflicts? |
|
Will this be merged in soon? Really critical |
|
Hi folks! Sorry for the delay on this one. We're currently working on a few breaking changes that are going to make up v2 of the library. Since this is also a breaking change (because of the Stay tuned, and thanks for your patience! |
WHY are these changes introduced?
The parameters required by
Sessionwere previously not being passed to the constructor, and we were instantiating instances ofSessionwith just theirid. This caused some issues due to potentially missing required params.An issue with
scopespotentially beingundefinedand causing errors in theAuthScopesclass is also fixed in this PR. This initially seemed like aSessionissue but was able to be resolved in theAuthScopeclass itself by allowingundefinedscopes in the constructor, which then translates to an empty array of scopes.The change to
AuthScopesshould potentially fix #159 and similar issues.WHAT is this pull request doing?
Sessionparams into the constructor.Sessionnew Sessionto pass the required params.AuthScopesto allow forundefinedin the constructor, and then check for the presence ofscope.important to note that a large portion of this PR is updates to test files
Type of change
Checklist