Skip to content
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

chore: minor, non-functional changes #876

Merged
merged 4 commits into from
Oct 16, 2023

Conversation

no-stack-dub-sack
Copy link
Collaborator

  • refactor: remove dead code
  • refactor: move handleEventDispatchErrors to lib
  • chore: fix typo
  • chore: add npmrc file to configure registry

* remove `actionThunks` variable from `extractDataFromModel` which was
no longer in use
* this is for developers who are configured to use private registries
at work. configuring at the project level will override any global
configuration for commands like `npm publish`.
@vercel
Copy link

vercel bot commented Oct 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
easy-peasy ❌ Failed (Inspect) Oct 13, 2023 5:27pm

@@ -26,7 +26,6 @@ export default function extractDataFromModel(
const _aCD = {};
const _aC = {};
const _aRD = {};
const actionThunks = {};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this was never being used. All tests still pass.

Comment on lines +216 to +236
const logEventListenerError = (type, err) => {
// eslint-disable-next-line no-console
console.log(`Error in ${type}`);
// eslint-disable-next-line no-console
console.log(err);
};

export const handleEventDispatchErrors =
(type, dispatcher) =>
(...args) => {
try {
const result = dispatcher(...args);
if (isPromise(result)) {
result.catch((err) => {
logEventListenerError(type, err);
});
}
} catch (err) {
logEventListenerError(type, err);
}
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the code a bit more DRY by replacing repeated code with shared util.

@@ -7,7 +7,7 @@ const noopStorage = {
removeItem: () => undefined,
};

const getBrowerStorage = (storageName) => {
const getBrowserStorage = (storageName) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For devs that use private NPM registries. Avoid conflicts with commands like npm publish

@jmyrland jmyrland changed the title chore: ninor, non-functional changes chore: minor, non-functional changes Oct 16, 2023
Comment on lines -129 to -131
// Register the thunk handler
set(path, actionThunks, def.thunkHandler);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't have tests covering this? IDK what actionThunks are

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this branch against our codebase, and we get 0 failures - so I guess this is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is related to this change: #876 (comment). The only place actionThunks was ever being used was here, the thunkHandler was being set on the object but then the object never got passed along to anything else. And if all the tests still pass, I'm thinking it's fine. Ctrl + Shift + F also turned up no other references to actionThunks. Obviously this isn't definitive because it could be passed to a func that calls it something else, but if deleting this line doesn't break anything else I think we're good.

Copy link
Collaborator

@jmyrland jmyrland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff 👌

@no-stack-dub-sack no-stack-dub-sack merged commit 0956256 into master Oct 16, 2023
7 of 8 checks passed
@no-stack-dub-sack no-stack-dub-sack deleted the chore/minor-non-functional-changes branch October 16, 2023 14:47
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.

2 participants