fix: Await asynchronous calls in ProjectViewPage and remove redundant Leaflet imports in WMSLayer
This commit is contained in:
@@ -17,8 +17,8 @@ import ProjectMap from "@/components/ui/ProjectMap";
|
|||||||
|
|
||||||
export default async function ProjectViewPage({ params }) {
|
export default async function ProjectViewPage({ params }) {
|
||||||
const { id } = await params;
|
const { id } = await params;
|
||||||
const project = getProjectWithContract(id);
|
const project = await getProjectWithContract(id);
|
||||||
const notes = getNotesForProject(id);
|
const notes = await getNotesForProject(id);
|
||||||
|
|
||||||
if (!project) {
|
if (!project) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ function WMSLayer({ url, params, opacity = 1, attribution }) {
|
|||||||
// Fix for default markers in react-leaflet
|
// Fix for default markers in react-leaflet
|
||||||
const fixLeafletIcons = () => {
|
const fixLeafletIcons = () => {
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
const L = require("leaflet");
|
|
||||||
|
|
||||||
delete L.Icon.Default.prototype._getIconUrl;
|
delete L.Icon.Default.prototype._getIconUrl;
|
||||||
L.Icon.Default.mergeOptions({
|
L.Icon.Default.mergeOptions({
|
||||||
iconRetinaUrl: "/leaflet/marker-icon-2x.png",
|
iconRetinaUrl: "/leaflet/marker-icon-2x.png",
|
||||||
@@ -70,8 +68,6 @@ const fixLeafletIcons = () => {
|
|||||||
// Create colored marker icons
|
// Create colored marker icons
|
||||||
const createColoredMarkerIcon = (color) => {
|
const createColoredMarkerIcon = (color) => {
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
const L = require("leaflet");
|
|
||||||
|
|
||||||
return new L.Icon({
|
return new L.Icon({
|
||||||
iconUrl: `data:image/svg+xml;base64,${btoa(`
|
iconUrl: `data:image/svg+xml;base64,${btoa(`
|
||||||
<svg width="25" height="41" viewBox="0 0 25 41" xmlns="http://www.w3.org/2000/svg">
|
<svg width="25" height="41" viewBox="0 0 25 41" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|||||||
Reference in New Issue
Block a user