Skip to content

Commit

Permalink
feat: replace use-hash-param with impl from cosmoz-page-router
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed Mar 1, 2022
1 parent 6aba118 commit f1e7c90
Show file tree
Hide file tree
Showing 8 changed files with 2,786 additions and 3,538 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "@neovici",
"rules": {
"indent": ["error", "tab", { "ignoredNodes": ["TemplateLiteral *"] }]
}
"extends": "./node_modules/@neovici/cfg/eslint"
}
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@neovici/cfg/prettier"
40 changes: 0 additions & 40 deletions lib/use-hash-param.js

This file was deleted.

6 changes: 2 additions & 4 deletions lib/use-tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect, useMemo, useCallback } from 'haunted';
import { notifyProperty } from '@neovici/cosmoz-utils/lib/hooks/use-notify-property';
import { useHashParam, link } from './use-hash-param';
import { useHashParam, link } from '@neovici/cosmoz-page-router/lib/use-hash-param';
import { choose, collect, getName, isValid } from './utils';
import computeScroll from 'compute-scroll-into-view';

Expand Down Expand Up @@ -89,9 +89,7 @@ const useTabSelectedEffect = (host, selectedTab) => {

e.preventDefault();
window.history.pushState({}, '', href(tab));
// TODO: drop this when we drop iron-location/cosmoz-page-location
requestAnimationFrame(() => window.dispatchEvent(new CustomEvent('location-changed')));
requestAnimationFrame(() => window.dispatchEvent(new CustomEvent('hash-changed')));
requestAnimationFrame(() => window.dispatchEvent(new CustomEvent('hashchange')));
}, []),
href
};
Expand Down
Loading

0 comments on commit f1e7c90

Please sign in to comment.