Fix updating map as plugins are selected
This commit is contained in:
parent
85630949c5
commit
e21271f78b
@ -248,10 +248,6 @@ const Map: React.FC = () => {
|
|||||||
|
|
||||||
const clearSelectedCells = useCallback(() => {
|
const clearSelectedCells = useCallback(() => {
|
||||||
setSelectedCells(null);
|
setSelectedCells(null);
|
||||||
if (router.query.plugin !== fetchedPlugin?.hash.toString(36)) {
|
|
||||||
console.log("clearing fetched plugin");
|
|
||||||
dispatch(setFetchedPlugin(undefined));
|
|
||||||
}
|
|
||||||
if (map.current) {
|
if (map.current) {
|
||||||
map.current.removeFeatureState({ source: "selected-cell-source" });
|
map.current.removeFeatureState({ source: "selected-cell-source" });
|
||||||
map.current.removeFeatureState({ source: "conflicted-cell-source" });
|
map.current.removeFeatureState({ source: "conflicted-cell-source" });
|
||||||
@ -259,7 +255,7 @@ const Map: React.FC = () => {
|
|||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (map.current) map.current.resize();
|
if (map.current) map.current.resize();
|
||||||
});
|
});
|
||||||
}, [map, fetchedPlugin, dispatch, router.query.plugin]);
|
}, [map]);
|
||||||
|
|
||||||
const clearSelectedMod = useCallback(() => {
|
const clearSelectedMod = useCallback(() => {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
@ -303,8 +299,6 @@ const Map: React.FC = () => {
|
|||||||
clearSelectedCell();
|
clearSelectedCell();
|
||||||
}
|
}
|
||||||
} else if (router.query.plugin && typeof router.query.plugin === "string") {
|
} else if (router.query.plugin && typeof router.query.plugin === "string") {
|
||||||
clearSelectedCell();
|
|
||||||
clearSelectedCells();
|
|
||||||
setSidebarOpen(true);
|
setSidebarOpen(true);
|
||||||
if (plugins && plugins.length > 0 && pluginsPending === 0) {
|
if (plugins && plugins.length > 0 && pluginsPending === 0) {
|
||||||
const plugin = plugins.find((p) => p.hash === router.query.plugin);
|
const plugin = plugins.find((p) => p.hash === router.query.plugin);
|
||||||
@ -369,7 +363,6 @@ const Map: React.FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (router.query.plugin && typeof router.query.plugin === "string" && fetchedPlugin && fetchedPlugin.cells) {
|
if (router.query.plugin && typeof router.query.plugin === "string" && fetchedPlugin && fetchedPlugin.cells) {
|
||||||
console.log("selecting fetchedPlugin cells");
|
|
||||||
const cells = [];
|
const cells = [];
|
||||||
const cellSet = new Set<number>();
|
const cellSet = new Set<number>();
|
||||||
for (const cell of fetchedPlugin.cells) {
|
for (const cell of fetchedPlugin.cells) {
|
||||||
|
@ -50,8 +50,7 @@ const PluginDetail: React.FC<Props> = ({ hash, counts }) => {
|
|||||||
const plugin = plugins.find((plugin) => plugin.hash === hash);
|
const plugin = plugins.find((plugin) => plugin.hash === hash);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data && !fetchedPlugin) {
|
if (data) {
|
||||||
console.log("setting fetched plugins from PluginDetail", data);
|
|
||||||
dispatch(setFetchedPlugin(data));
|
dispatch(setFetchedPlugin(data));
|
||||||
}
|
}
|
||||||
}, [dispatch, data, fetchedPlugin])
|
}, [dispatch, data, fetchedPlugin])
|
||||||
|
Loading…
Reference in New Issue
Block a user